Advertisement
Guest User

Untitled

a guest
Sep 21st, 2017
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.32 KB | None | 0 0
  1. #include<stdio.h>
  2. #include<pthread.h>
  3. void* say_hello(void* data)
  4. {
  5. char
  6. *str;
  7. str = (char*)data;
  8. while(1){
  9. printf("%s\n",str);
  10. sleep(1);
  11. }
  12. }
  13.  
  14. void main() {
  15. pthread_t t1,t2;
  16. pthread_create(&t1,NULL,say_hello,"hello from 1");
  17. pthread_create(&t2,NULL,say_hello,"hello from 2");
  18. pthread_join(t1,NULL);
  19. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement