If I open a serial port in thread 1 and then close it, I can open it in thread 2 and use it. In that way, I can allow multiple threads to communicate with the same port, as long as each thread closes the port and the next thread opens it.

But would it be possible to open a port in thread 1 and then communicate with it in thread 2, without closing it in thread 1 and without opening it in thread 2? Particularly for Windows?

有帮助吗?

解决方案

Yes, it's possible to open a serial port once and let multiple threads communicate on it. Each thread needs to know the handle of the serial port, though.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top