Question: b . Consider the program below, where represents code that updates a shared data structure. ` ` ` void * thread _ func
b Consider the program below, where represents code that updates a shared data structure.
void threadfuncvoid arg
pthreadmutext mymutex;
int rv pthreadmutexinit&mymutex,NULL; default attributes
rv pthreadmutexlock&mymutex;
assertrv;
critical section
rv pthreadmutexunlock&mymutex;
assertrv;
return NULL;
The main program creates and executes threads running threadfunc What is wrong with the above code? Hint: it has nothing to do with the variable rv or the call to assert.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
