Tutorial by Examples

This basic example counts at different rates on two threads that we name sync (main) and async (new thread). The main thread counts to 15 at 1Hz (1s) while the second counts to 10 at 0.5Hz (2s). Because the main thread finishes earlier, we use pthread_join to make it wait async to finish. #include ...
POSIX thread library provides implementation of the mutex primitive, used for the mutual exclusion. Mutex is created using pthread_mutex_init, and destroyed using pthread_mutex_destroy. Obtaining a mutex can be done using pthread_mutex_lock or pthread_mutex_trylock, (depending if the timeout is desi...

Page 1 of 1