Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<pthread.h>
- #include<stdio.h>
- #include<stdlib.h>
- #include<unistd.h>
- #include<string.h>
- #include<sched.h>
- void* Super_watek1(void * buffor){
- printf("WATEK %lu pid %d \n",pthread_self(),getpid());
- exit(EXIT_FAILURE);
- }
- int main()
- {
- pthread_t watek1;
- pthread_t watek2;
- int w1=pthread_create(&watek1, NULL, Super_watek1,(void*)NULL);
- int w2=pthread_create(&watek2, NULL, Super_watek1,(void*)NULL);
- if(w1!=0&&w2!=0){
- fprintf(stderr,"pthread_create() error: %d\n",w1);
- fprintf(stderr,"pthread_create() error: %d\n",w2);
- }
- w1=pthread_join(watek1, NULL);
- w2=pthread_join(watek2, NULL);
- if(w1!=0&&w2!=0){
- fprintf(stderr,"pthread_join() error: %d\n",w1);
- fprintf(stderr,"pthread_join() error: %d\n",w2);
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement