Last active
July 14, 2018 09:23
-
-
Save legnaleurc/40957126e07db088956153396fbcd826 to your computer and use it in GitHub Desktop.
thread
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <pthread.h> | |
void * worker (void * o) { | |
int * p = NULL; | |
printf("%d\n", *p); | |
return NULL; | |
} | |
int main () { | |
pthread_t tid; | |
pthread_attr_t attr; | |
void * rv; | |
pthread_attr_init(&attr); | |
pthread_create(&tid, &attr, worker, NULL); | |
pthread_join(tid, &rv); | |
printf("main exit\n"); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment