Given the following environment
#include
int data;
pthread_mutex_t mutex;
int main()
{
data = 0;
pthread_mutex_init(&mutex, NULL);
// Code Fragment Goes Here
return 0;
}
Write a code fragment that locks the mutex, increments the value of data by 1 and then unlocks the mutex.
pthread_mutex_lock(&mutex);
data++;
pthread_mutex_unlock(&mutex);
Computer Science & Information Technology
You might also like to view...
Poor ________ design impairs performance, especially when it is used to store large amounts of data
Fill in the blank(s) with correct word
Computer Science & Information Technology
The text box control displays ________ when the control is not linked to a field
Fill in the blank(s) with correct word
Computer Science & Information Technology