C4 Engine
C4 Engine API Documentation

Mutex::TryAcquire

Defined in:  C4Root.h
Attempts to acquire exclusive ownership of a mutex.
Prototype

bool TryAcquire(void);

Description
The TryAcquire function attempts to acquire exclusive ownership of a mutex. If the acquisition is successful, then the function returns true, and the mutex behaves as if the Mutex::Acquire function had been called. If the acquisition fails, then the function does not block and immediately returns false.

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

If the TryAcquire function is called for a mutex already owned by the calling thread, then true is returned, and the internal acquisition count for the mutex is incremented. Each call to the TryAcquire function that returns true must be balanced by a corresponding call to the Mutex::Release function by the same thread.
See Also

Mutex::Acquire

Mutex::Release