test_pthread_create.c revision e16cb84e2324f05334d18dcf5956f20f44262b62
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