C4 Engine
C4 Engine API Documentation


Defined in:  C4Root.h
Acquires exclusive ownership of a mutex.

void Acquire(void);

The Acquire function acquires exclusive ownership of a mutex. If the mutex is already owned by another thread when this function is called, then the calling thread blocks until the mutex becomes available.

Ownership of a mutex is relinquished by calling the Mutex::Release function from the same thread that called the Acquire function.

All mutexes are recursive, meaning that a thread already owning a mutex may reacquire the same mutex without deadlocking, and the system maintains an internal acquisition count. Each call to the Acquire function must be balanced by a corresponding call to the Mutex::Release function by the same thread.

The Mutex::TryAcquire function allows the caller to attempt to acquire ownership of a mutex without blocking if the acquisition attempt fails.
See Also