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.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
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.