K
ksukat63
Guest
I am developing a custom windows service that communicates over the serial port to some custom hardware.
I have multiple threads and been having quite a hard time getting them to write to the serial port without stepping on each other. Recent guidance says don't do that . Use BlockingCollection and a single thread that writes/reads the serial port. In essence the BlockingCollection is the command queue for the serial port.
When the service starts it launches a thread which is a polling loop (infinite) which sends a command to the serial port to get data from the hardware. It starts another thread which listens on a socket for a diagnostic command, this also is infinite.
So, I have (2) infinite producers and 1 consumer. Is this possible using BlockingCollection ?
Thanks a million.
Continue reading...
I have multiple threads and been having quite a hard time getting them to write to the serial port without stepping on each other. Recent guidance says don't do that . Use BlockingCollection and a single thread that writes/reads the serial port. In essence the BlockingCollection is the command queue for the serial port.
When the service starts it launches a thread which is a polling loop (infinite) which sends a command to the serial port to get data from the hardware. It starts another thread which listens on a socket for a diagnostic command, this also is infinite.
So, I have (2) infinite producers and 1 consumer. Is this possible using BlockingCollection ?
Thanks a million.
Continue reading...