Is there a way in the pthreads API that I can have one thread instruct either itself or another thread to pause?
By pause, I mean stop executing and stop getting scheduled until another thread signals it to resume.
In pthread / POSIX Thread stack, you may use pthread_kill to send signals to individual threads; but unfortunately that doesnt include "stop", "continue", or "terminate". See the Notes here
If you are only interested in pausing the thread; a crafty formula of mutexes and conditional variables are the best way forward.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With