First page Back Continue Last page Overview Graphics
Linux mutexes
The main locking primitive since Linux 2.6.16.
Better than counting semaphores when binary ones are enough.
The process requesting the lock blocks when the lock is already held. Mutexes can therefore only be used in contexts where sleeping is allowed.
Mutex definition:
#include <linux/mutex.h>
Initializing a mutex statically:
DEFINE_MUTEX(name);
Or initializing a mutex dynamically:
void mutex_init(struct mutex *lock);