Pike v8.1 release 6

Class Thread.Mutex

Inheritance graph
Thread.Mutex Thread.Fifo Thread.Queue
Description

Mutex is a class that implements mutual exclusion locks. Mutex locks are used to prevent multiple threads from simultaneously execute sections of code which access or change shared data. The basic operations for a mutex is locking and unlocking. If a thread attempts to lock an already locked mutex the thread will sleep until the mutex is unlocked.

Note

This class is simulated when Pike is compiled without thread support, so it's always available.

In POSIX threads, mutex locks can only be unlocked by the same thread that locked them. In Pike any thread can unlock a locked mutex.