Mutexes are typically used to serialise access to a section of re-entrant code that cannot be executed concurrently by more than one thread. A mutex object only allows one thread into a controlled section, forcing other threads which attempt to gain access to that section to wait until the first thread has exited from that section.
A mutex can be used by threads across any number of processes. If a resource is only shared between the threads within the same process, it can be more efficient to use a critical section.
Mutexes are Kernel objects and, as such, are managed by the Kernel, and accessed by user programs through handles.
The mutex handle is provided by RMutex
.
TFindMutex
is used for finding a mutex created
by another process.