C4 Engine
C4 Engine API Documentation

class Lock

Defined in:  C4Threads.h
The Lock class encapsulates a shared lock object for multithreaded synchronization.

class Lock

Member Functions
Lock::AcquireExclusive Acquires exclusive access to a lock.
Lock::ReleaseExclusive Releases exclusive access to a lock.
Lock::AcquireShared Acquires shared access to a lock.
Lock::ReleaseShared Releases shared access to a lock.


The Lock class defines a platform-independent shared lock object that can be used for multithreaded synchronization. A lock object can be acquired for exclusive access by a single thread, or it can be acquired for shared access by multiple threads simultaneously. Exclusive access is ordinarily required when a thread is going to write to a shared resource, and shared access is ordinarily sufficient when multiple threads only need to read from a shared resource.
WARNING. If a lock object is destroyed while a thread is waiting on it, then the behavior is undefined.
See Also