Advertisement
salmaNAS

Untitled

Oct 26th, 2019
110
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.47 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. #include <unistd.h> //Header file for sleep(). man 3 sleep for details.
  4. #include <pthread.h>
  5.  
  6. void *myThreadFun(void *vargp)
  7. {
  8. sleep(1);
  9. printf("Printing GeeksQuiz from Thread \n");
  10. return NULL;
  11. }
  12.  
  13. int main()
  14. {
  15. pthread_t thread_id;
  16. printf("Before Thread\n");
  17. pthread_create(&thread_id, NULL, myThreadFun, NULL);
  18. pthread_join(thread_id, NULL);
  19. printf("After Thread\n");
  20. exit(0);
  21. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement