Domanda

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?

È stato utile?

Soluzione

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.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top