Question: Consider the following multi - threaded C pseudocode: 1 . void * getMsg ( ) { 2 . lock ( &mutex ) ; 3 .
Consider the following multithreaded C pseudocode:
void getMsg
lock&mutex;
semwait&sem;
void msg popQueue&queue;
unlock&mutex;
return msg;
void addMsgvoid msg
lock&mutex;
pushQueue&queue, msg;
unlock&mutex;
sempost&sem;
How can you fix the bugs in this code? Select all of the changes that must be applied to make this
code work.
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
