Files
ostep-code/threads-api/thread_create_simple_args.c
Remzi Arpaci-Dusseau 502a67f965 some thread API examples
2019-04-23 12:12:17 -05:00

20 lines
437 B
C

#include <stdio.h>
#include <pthread.h>
#include "common_threads.h"
void *mythread(void *arg) {
long long int value = (long long int) arg;
printf("%lld\n", value);
return (void *) (value + 1);
}
int main(int argc, char *argv[]) {
pthread_t p;
long long int rvalue;
Pthread_create(&p, NULL, mythread, (void *) 100);
Pthread_join(p, (void **) &rvalue);
printf("returned %lld\n", rvalue);
return 0;
}