27.4.4.1. pthread_mutex

userland/posix/pthread_count.c exemplifies the functions:

  • pthread_mutex_lock

  • pthread_mutex_unlock

That example that the same interface as: atomic.cpp. There are no non-locking atomic types or atomic primitives in POSIX: http://stackoverflow.com/questions/1130018/unix-portable-atomic-operations

pthread_mutex_lock and pthread_mutex_unlock and many other pthread functions already enforce cross thread memory synchronization: