int main() { initialize_flag(); pthread_t thread_id; pthread_create(&thread_id, NULL, &thread_function, NULL); printf("flag not set...\n"); sleep(5); set_thread_flag(1); printf("flag alredey set...\n"); pthread_join(thread_id, NULL); return 0; }
int main() { pthread_t thread; int a = 10; int b; initialize_flag(); pthread_create(&thread, NULL, thread_function, &a); set_thread_flag(123); pthread_join(thread, (void *)&b); printf("%s : return b[%d]\n", __FUNCTION__, b); //while(1); return 0; }