Hi,
I have a monitor thread that I would like to monitor ADC values under some algorithm. What is the best way to start/stop this thread from a controller thread? I would like to start it and stop it once a result has been found.
thought about using a binary semaphore, and waiting on the semaphore in the first statement of the while TRUE loop. The other thread would then signal the monitor thread to continue. However, when it reaches the top of the while loop the thread will suspend again. I would like it to continue until some point in the future determined by the controller thread.
Does anyone have any suggestions?
Controlling threads
Moderators: RoccoMarco, lbednarz, tfAteba
- Giovanni
- Site Admin
- Posts: 14895
- Joined: Wed May 27, 2009 8:48 am
- Has thanked: 1202 times
- Been thanked: 997 times
Re: Controlling threads
Hi,
You could make the call to chSemWait() conditional and decide when to do that and when to skip it and restart, you could check a global flag.
Giovanni
You could make the call to chSemWait() conditional and decide when to do that and when to skip it and restart, you could check a global flag.
Giovanni