程序代写 #include – cscodehelp代写
#include pthread_mutex_t mutex1 = PTHREAD_MUTEX_INITIALIZER; Copyright By cscodehelp代写 加微信 cscodehelp thread_func (void *ptr)
#include
for (i = 0; i < 10; i++)
pthread_mutex_lock (&mutex1);
printf ("%d", *(int*)ptr);
pthread_mutex_unlock (&mutex1);
system("sleep 0.1");
pthread_t t1, t2;
int t_id1, t_id2, a=1, b=2;
t_id1 = pthread_create (&t1, NULL, (void *) &thread_func, &a);
t_id2 = pthread_create (&t2, NULL, (void *) &thread_func, &b);
pthread_join (t1, NULL);
pthread_join (t2, NULL);
程序代写 CS代考 加微信: cscodehelp QQ: 2235208643 Email: kyit630461@163.com