10 void *thread1_func(void *arg)
16 snprintf(buf, sizeof(buf), "thread1: %d %s\n", i, (char *)arg);
17 write(1, buf, strlen(buf));
23 void *thread2_func(void *arg)
28 snprintf(buf, sizeof(buf), "thread2: %d %s\n", i, (char *)arg);
29 write(1, buf, strlen(buf));
35 void test_pthread(void)
39 pthread_create(&tid1, NULL, thread1_func, "hello1");
40 pthread_create(&tid2, NULL, thread2_func, "hello2");
41 pthread_join(tid1, NULL);
42 pthread_join(tid2, NULL);
43 printf("End of pthread test.\n");
46 int main(int argc, char **argv)