Computers and Technology

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
}

answer
Answers: 2

Other questions on the subject: Computers and Technology

image
Computers and Technology, 22.06.2019 18:30, Jessieeeeey
Kto rozmawia z clamentain przez krótkofalówke w the walking dead która śledzi lee w 4 epizodzie
Answers: 1
image
Computers and Technology, 22.06.2019 22:00, noeminm105
Consider the following declarations (1, 2, 3, 5, 7)class bagtype{public: void set(string, double, double, double, double); void print() const; string getstyle() const; double getprice() const; void get(double, double, double, double); bagtype(); bagtype(string, double, double, double, double); private: string style: double l; double w; double h; double price; }; a.) write the definition of the number function set so that private members are set according to the parametersb.) write the definition of the member function print that prints the values of the data membersc.) write the definition of the default constructor of the class bagtype so that the private member variables are initialized to "", 0.0, 0.0, 0.0, 0.0, respectively d.) write a c++ statement that prints the value of the object newbag. e.) write a c++ statement that declares the object tempbag of type bagtype, and initialize the member variables of tempbag to "backpack", 15, 8, 20 and 49.99, respectively
Answers: 3
image
Computers and Technology, 24.06.2019 12:50, vianca15
What percentage of teens plays video games? a.97% b.100% c.74% d.50%
Answers: 1
image
Computers and Technology, 24.06.2019 19:30, hermine40
Which phrase is the best definition of a pivottable a a table containing data that is organized horizontally b a table used to calculate financial pivot values c a tool used to summarize data d a table containing specific formatting
Answers: 1
Do you know the correct answer?
Read the man page of the following functions pthread_create, pthread_join. Read the man page of the...

Questions in other subjects: