Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdlib.h>
- #include <stdio.h>
- #include <pthread.h>
- #include <sys/types.h>
- #include <unistd.h>
- #include <error.h>
- void * watek(void * par)
- {
- printf("watek1: ID watku: %lu Proces: %d\n", (unsigned long)pthread_self(), getpid());
- //printf("Parametr: %d\n", *par);
- return 0;
- }
- int main(int argc, char*argv[])
- {
- pthread_t t1, t2;
- //int rc;
- //pthread_create()
- if(pthread_create(&t1, NULL, watek, (void*)NULL) != 0)
- exit(EXIT_FAILURE);
- if(pthread_create(&t2, NULL, watek, (void*)NULL) != 0)
- exit(EXIT_FAILURE);
- int err;
- err = pthread_join(t1, NULL);
- if(err != 0){
- perror("pthread_join");
- }
- err = pthread_join(t2, NULL);
- if(err != 0){
- perror("pthread_join");
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement