View on GitHub

DSFML

dsfml.system.mutex

A module containing the Mutex class used by DSFML.

class Mutex;
Blocks concurrent access to shared resources from multiple threads.

Mutex stands for "MUTual EXclusion".

A mutex is a synchronization object, used when multiple threads are involved.

When you want to protect a part of the code from being accessed simultaneously by multiple threads, you typically use a mutex. When a thread is locked by a mutex, any other thread trying to lock it will be blocked until the mutex is released by the thread that locked it. This way, you can allow only one thread at a time to access a critical region of your code.

this();
Default Constructor

void lock();
Lock the mutex

If the mutex is already locked in another thread, this call will block the execution until the mutex is released.