Skip to content

Instantly share code, notes, and snippets.

@legnaleurc
Last active July 14, 2018 09:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save legnaleurc/40957126e07db088956153396fbcd826 to your computer and use it in GitHub Desktop.
Save legnaleurc/40957126e07db088956153396fbcd826 to your computer and use it in GitHub Desktop.
thread
#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