Another question to threads
-
I have created a separate thread to continuously monitor the serial port (i.e. to wait for something to arrive and then read it out) Is it possible to write to the serial port at the same time (in the main thread), or does the read thread block. I have tried...it didn´t work, but the problem might be somewhere else... If I cannot send while monitoring the port, what would be the proper solution? Do I have to temporarily Suspend, Sleep or Abort the thread while performing the write operation? doneirik
-
I have created a separate thread to continuously monitor the serial port (i.e. to wait for something to arrive and then read it out) Is it possible to write to the serial port at the same time (in the main thread), or does the read thread block. I have tried...it didn´t work, but the problem might be somewhere else... If I cannot send while monitoring the port, what would be the proper solution? Do I have to temporarily Suspend, Sleep or Abort the thread while performing the write operation? doneirik
IIRC you should use overlapped IO for the serial read write. Ant. I'm hard, yet soft.
I'm coloured, yet clear.
I'm fruity and sweet.
I'm jelly, what am I? Muse on it further, I shall return! - David Walliams (Little Britain) -
I have created a separate thread to continuously monitor the serial port (i.e. to wait for something to arrive and then read it out) Is it possible to write to the serial port at the same time (in the main thread), or does the read thread block. I have tried...it didn´t work, but the problem might be somewhere else... If I cannot send while monitoring the port, what would be the proper solution? Do I have to temporarily Suspend, Sleep or Abort the thread while performing the write operation? doneirik
it is not neccessary to write in a thread - thread is for waiting (reading) events. before u write, u need to check if writing (sending) buffer is empty - otherwise writing fails. i have worked for years on your current job. includeh10