Question: Pthread _ mutex _ lock ( &lock ) ; while ( ready = = 0 ) Pthread _ cond _ wait ( &cond, &lock )

Pthread_mutex_lock(&lock);
while(ready ==0)
Pthread_cond_wait(&cond, &lock);
Pthread_mutex_unlock(&lock);
In above section of code, what happens with method call of wait(&cond, &lock)? Choose all answers applicable.
The calling thread relinquishs the lock.
The calling thread suspends execution and enters into a waiting state.
The calling thread, after being notified of the waited condition, will reacquire the lock.
After reacquiring the lock, the waken thread will check the condition in while( ready ==0). If the condition is true, the calling thread will proceed.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!