class Lock
Defined in:
The C4Threads.h
Lock
class encapsulates a shared lock object for multithreaded synchronization.
Definition
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. |
Constructor
Lock();
Description
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