Advertisement
Guest User

Untitled

a guest
Nov 20th, 2017
55
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.83 KB | None | 0 0
  1. #include<pthread.h>
  2. #include<stdio.h>
  3. #include<stdlib.h>
  4. #include<unistd.h>
  5. #include<string.h>
  6. #include<sched.h>
  7. void* Super_watek1(void * buffor){
  8. printf("WATEK %lu pid %d \n",pthread_self(),getpid());
  9. exit(EXIT_FAILURE);
  10. }
  11.  
  12. int main()
  13. {
  14. pthread_t watek1;
  15. pthread_t watek2;
  16. int w1=pthread_create(&watek1, NULL, Super_watek1,(void*)NULL);
  17. int w2=pthread_create(&watek2, NULL, Super_watek1,(void*)NULL);
  18. if(w1!=0&&w2!=0){
  19. fprintf(stderr,"pthread_create() error: %d\n",w1);
  20. fprintf(stderr,"pthread_create() error: %d\n",w2);
  21. }
  22.  
  23. w1=pthread_join(watek1, NULL);
  24. w2=pthread_join(watek2, NULL);
  25.  
  26. if(w1!=0&&w2!=0){
  27. fprintf(stderr,"pthread_join() error: %d\n",w1);
  28. fprintf(stderr,"pthread_join() error: %d\n",w2);
  29. }
  30.  
  31. return 0;
  32. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement