I'm learning pthreads after learning about regular threads. Normally when we use a boolean thread object we declare it as a volatile object like this: volatile bool thread_lock;
. Do we need to do this on pthread objects as well, specifically on pthread_mutex_t
when needed or does it handle it itself?
I've looked up into the pthread_mutex_t
declaration and found out that it does not have a volatile declaration.
Should it be volatile pthread_mutex_t my_obj;
or pthread_mutex_t my_obj;