#include #include int results[2] = {0, 0}; void *thread_one(void *unused) { (void)unused; results[0] = 10 + 20; return NULL; } void *thread_two(void *unused) { (void)unused; results[1] = 30 + 40; return NULL; } int main(void) { pthread_t t1, t2; printf("main: begin\n"); pthread_create(&t1, NULL, thread_one, NULL); pthread_create(&t2, NULL, thread_two, NULL); pthread_join(t1, NULL); pthread_join(t2, NULL); printf("result0=%d result1=%d\n", results[0], results[1]); printf("main: end\n"); return 0; }