Im new to implementation of pthreads
Im using pthreads for two separate actions but in some cases i will have to use data updated from first thread to be used by the other, so just a global variable, with mutex will work or is there any particular variable to be used?
Another thing is that how can i make a pthreads wait until a particular condition is achieved, now i use a "if" condition, but here, thread will be running continuously(Utilizing system recourses) and if condition is satisficed that piece of code works
I was looking for something like an interrupt is it possible?
similarly stopping a pthread, should i use pthreadexit?
Mutex + variable is sufficient. For second part of your question, please read about conditionals and how to use it with pthread (good start point can be https://linux.die.net/man/3/pthread_cond_signal )
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.