8 static void* func(void* data
)
20 pthread_create(&tid
, NULL
, func
, NULL
);
22 while (sem_trywait(&sem
))
23 ; // do nothing but keep retrying
25 /* The above loop could be replaced this instead:
26 * if (sem_trywait(&sem))
30 printf("%s\n", result
);
32 pthread_join(tid
, NULL
);