Am Samstag, den 26.07.2014, 09:16 +0200 schrieb Jens Gustedt: > And you are right mentioning that, in many situations spin locks do > effectively suffice. C11 has atomic_flag for that. Often locks are > just taken for critical sections of code that do a small task, just > some instructions. Curiously, I just tracked down a use of pthread_mutex_lock and pthread_mutex_unlock that I couldn't explain. It came from libatomic as of gcc-4.9.0. Looking into that, I see that they got the locking part for the non lock-free atomics in their POSIX version plain wrong. Not only that this sucks in the symbols which they shouldn't, but pthread_mutex_t is just not the right tool for the task. It should be atomic_flag. Jens -- :: INRIA Nancy Grand Est ::: AlGorille ::: ICube/ICPS ::: :: ::::::::::::::: office Strasbourg : +33 368854536 :: :: :::::::::::::::::::::: gsm France : +33 651400183 :: :: ::::::::::::::: gsm international : +49 15737185122 :: :: http://icube-icps.unistra.fr/index.php/Jens_Gustedt ::