11 void *thread1_func(void *arg)
17 snprintf(buf, sizeof(buf), "thread1: %d %s\n", i, (char *)arg);
18 write(1, buf, strlen(buf));
24 void *thread2_func(void *arg)
29 snprintf(buf, sizeof(buf), "thread2: %d %s\n", i, (char *)arg);
30 write(1, buf, strlen(buf));
36 void test_pthread(void)
40 pthread_create(&tid1, NULL, thread1_func, "hello1");
41 pthread_create(&tid2, NULL, thread2_func, "hello2");
42 pthread_join(tid1, NULL);
43 pthread_join(tid2, NULL);
44 printf("End of pthread test.\n");
47 int main(int argc, char **argv)