test_pthread_create.c revision ab8beedeb70c6941e0ff68014d8db64cee4ef15d
1#include <pthread.h>
2#include <stdio.h>
3#include <unistd.h>
4
5static void *
6thread1_func(void* arg)
7{
8    printf("Thread 1 (arg=%d tid=%d) entered.\n", (unsigned)arg, gettid());
9    return 0;
10}
11
12static void *
13thread2_func(void* arg)
14{
15    printf("thread 2 (arg=%d tid=%d) entered.\n", (unsigned)arg, gettid());
16    return 1;
17}
18
19
20int main( void )
21{
22    pthread_t t1, t2;
23
24    pthread_create( &t1, NULL, thread1_func, (void *)1 );
25
26    pthread_join(t1, NULL);
27
28    printf("OK\n");
29    return 0;
30}
31