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

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 15:30
When creating a budget, log fixed expenses before income. after income. after savings. at the top.
Answers: 1
question
Computers and Technology, 23.06.2019 12:40
According to the video what are some tasks petroleum engineers perform check all that apply
Answers: 2
question
Computers and Technology, 23.06.2019 14:30
Select the correct answer. sean is a computer programmer. he has programmed an application for toddlers that plays nursery rhymes. however, a logic error has occurred in the program. which problem is a likely consequence of the error? a. the program crashes every time the user wants to play the nursery rhymes. b. the program crosses its buffer boundaries and overwrites an adjacent program. c. the program plays a different nursery rhyme than the one the user intended to play. d. the program shows different structures in its programming language code. e. the program introduces new viruses every time the user plays a nursery rhyme.
Answers: 1
question
Computers and Technology, 23.06.2019 15:30
Brian wants to conduct an online search with a certain phrase. he intends to use the words books that belong to the 1800s in his search. how should he use the word that in his search?
Answers: 1
You know the right answer?
Read the man page of the following functions pthread_create, pthread_join. Read the man page of the...
Questions
question
Mathematics, 12.10.2020 21:01
question
Social Studies, 12.10.2020 21:01
question
Mathematics, 12.10.2020 21:01
question
Mathematics, 12.10.2020 21:01
question
French, 12.10.2020 21:01
Questions on the website: 13722360