[Return to Bookshelf] [Contents] [Previous Section] [Next Section] [Index] [Help]


3.1.1 Memory Synchronization

Applications must ensure that access to data shared between threads is synchronized. POSIX 1003.1c-1995 guarantees that the following functions shall synchronize memory with respect to other threads:

fork, pthread_create, pthread_join, pthread_mutex_lock, pthread_ mutex_trylock, pthread_mutex_unlock, pthread_cond_wait, pthread_ cond_timedwait, pthread_cond_signal, pthread_cond_broadcast, sem_ post, sem_trywait, sem_wait, wait, waitpid

Synchronization is not guaranteed if the function returns an error. For example, an unsuccessful pthread_mutex_trylock does not necessarily provide any synchronization.