subject

Read the man page of the following functions pthread_create, pthread_join. Read the man page of the following functions pthread_mutex_init, pthread_mutex_lock, pthread_mutex_trylock, pthread_mutex_unlock, pthread_mutex_destroy. For each task, fullfill the requirements provided in the comments, or fill the blank. Compile the code and make sure it is executable. What is the output of the code? #include
#include
#include
void *functionc ();
pthread mutex t mutex1 PTHREAD MUTEX INITIALIZER
int counter = 0 ;
main ()
int rc1, rc2
pthread_t thread1, thread2;
* Create independent threads each of which will execute functionC*/
if ((rc1-pthread_create (&thread1, NULL,
printf ( "Thread creation failed : %d\n", rc1 ) ; , NULL))) if (( rc2-pthread_create (&thread2, NULL, , NULL)))
printf ( "Thread creation failed : %d\n" , rc2 ) ;
pthread_join ( pthread_join ( return (0); NULL) , NULL);
void *functionc () (
pthread_mutex_lock (
counter++
printf ( "Counter value : %d\n" , counter) ;
pthread mutex_unlock
}

ansver
Answers: 2

Other questions on the subject: Computers and Technology

image
Computers and Technology, 23.06.2019 00:00, dubouuu
Donna and her team of five have invented a new gadget for the science exhibition in their college. which intellectual property right will protect their invention?
Answers: 1
image
Computers and Technology, 23.06.2019 00:30, vane3152
If joey was single and his taxable income was $9,500, how much would he pay in taxes each year?
Answers: 1
image
Computers and Technology, 23.06.2019 01:10, kristofwr3444
Are special combinations of keys that tell a computer to perform a command. keypads multi-keys combinations shortcuts
Answers: 1
image
Computers and Technology, 23.06.2019 16:00, natasniebow
Kenny works with an it company. his company is about to launch new software in the market. he has to ensure that this new software is functional and meets all of the quality standards set up at the planning stage. which job profile is kenny likely to have? kenny is likely to have the job profile of a blank .
Answers: 2
You know the right answer?
Read the man page of the following functions pthread_create, pthread_join. Read the man page of the...

Questions in other subjects: