Advertisement
tsnaik

OS lab5

Aug 10th, 2015
594
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.44 KB | None | 0 0
  1. /**
  2. *OS Lab 5
  3. *11/8/2015
  4. *Tanmay Naik
  5. */
  6.  
  7. /*---------------------*/
  8.  
  9. //basic thread
  10. #include<stdio.h>
  11. #include<stdlib.h>
  12. #include<pthread.h>
  13.  
  14. void *f(void *);
  15.  
  16. int main()
  17. {
  18.     pthread_t t1,t2;
  19.     char *m1="Hello";
  20.     char *m2="Hi";
  21.  
  22.     pthread_create(&t1,NULL,f,(void*)m1);
  23.     pthread_create(&t2,NULL,f,(void*)m2);
  24.    
  25.     pthread_join(t1,NULL);
  26.     pthread_join(t2,NULL);
  27.    
  28.     return 0;
  29. }
  30.  
  31. void *f(void *m)
  32. {
  33.     printf("\n%s",(char*)m);
  34.  
  35. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement