Advertisement
Guest User

tu wbijaj jak cos to lab 7 zad1

a guest
Jun 23rd, 2018
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.81 KB | None | 0 0
  1. #include <sys/types.h>
  2.  
  3. #include <sys/stat.h>
  4.  
  5. #include <fcntl.h>
  6.  
  7. #include <pthread.h>
  8.  
  9. #include <string.h>
  10.  
  11. #include <sys/file.h>
  12.  
  13. #include <stdlib.h>
  14.  
  15. #include <stdio.h>
  16.  
  17. #include <unistd.h>
  18.  
  19. #include <time.h>
  20.  
  21.  
  22.  
  23.  
  24.  
  25. void *fun_watek1(void * p);
  26.  
  27. void *fun_watek2(void * p);
  28.  
  29.  
  30.  
  31. int main() {
  32.  
  33. pthread_t watek1;
  34.  
  35. pthread_t watek2;
  36.  
  37.  
  38.  
  39. pthread_create(&watek1, NULL, fun_watek1, (void *)&watek1);
  40.  
  41. pthread_create(&watek2, NULL, fun_watek2, (void *)&watek2);
  42.  
  43.  
  44.  
  45. pthread_join(watek1, NULL);
  46.  
  47. pthread_join(watek2, NULL);
  48.  
  49.  
  50.  
  51.  
  52.  
  53. return0;
  54.  
  55. }
  56.  
  57.  
  58.  
  59. void *fun_watek1(void * p) {
  60.  
  61. printf("Watek 1: %lu, PID: %d\n", pthread_self(), getpid());
  62.  
  63. return0;
  64.  
  65. }
  66.  
  67.  
  68.  
  69. void *fun_watek2(void * p) {
  70.  
  71. printf("Watek 2: %lu, PID: %d\n", pthread_self(), getpid());
  72.  
  73. return0;
  74.  
  75. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement