pthreads.c

(plain text)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#include <pthread.h>
#include <stdio.h>

void *routine (void *p)
{
	printf("%#x\n", *(int *)p);
	return p;
}

int main ()
{
	pthread_t thread;
	pthread_attr_t attr;
	int i = 0xdeadbeef;
	pthread_attr_init(&attr);
	pthread_create(&thread, &attr, routine, &i);
	pthread_join(thread, 0);
	pthread_attr_destroy(&attr);
}