Currently I have 3 threads running. A main application thread and 2 worker threads handling communications between the 2 serial ports.
When the following code is runn problems arise :
The first line in the code direct a message to be sent out through one of the serial ports via the appropriate worker thread. The message updates the position of a robot.
The second line performs some analysis by the main application thread based on video image recieved from the updated robot position.
The problem is that the first command is executing half way by the worker thread when its time slice ends and the main thread continues the 2nd analysis command. Since the analysis is to be based upon the updated position, it becomes invalid.
This is especially so when the 2 commands are placed in a for loop. Multiple analysis are done on invalid positions.
Thus is there some way to force the worker thread to execute before running the analysis command?
The main thread cannot be suspended indefinitely as it is responsible for refreshing and updating full motion video to the screen.
thanks and regards