|
|
@@ -137,8 +137,6 @@ void CPosPrinterWorker::StartShouyinChannels()
|
|
|
ch->portPath = it->first;
|
|
|
ch->portKind = it->second;
|
|
|
|
|
|
- OpenChannelHandle(ch);
|
|
|
-
|
|
|
ch->worker = std::thread(&CPosPrinterWorker::ChannelWorker, this, ch);
|
|
|
new_channels.push_back(ch);
|
|
|
}
|
|
|
@@ -190,6 +188,12 @@ void CPosPrinterWorker::StopShouyinChannels()
|
|
|
|
|
|
void CPosPrinterWorker::ChannelWorker(std::shared_ptr<CPortSendChannel> ch)
|
|
|
{
|
|
|
+ //在通道线程中打开端口,避免驱动响应慢时阻塞 Start 或设置刷新调用
|
|
|
+ if (ch->hPort == NULL)
|
|
|
+ {
|
|
|
+ OpenChannelHandle(ch);
|
|
|
+ }
|
|
|
+
|
|
|
while (true)
|
|
|
{
|
|
|
std::string data;
|