OWLNext 7.0
Borland's Object Windows Library for the modern age
|
Mutual-exclusive semaphore. More...
#include <owl/thread.h>
Public Types | |
typedef TLock | Lock |
For compatibility with old T-less typename. | |
Public Types inherited from owl::TSemaphore | |
enum | { NoWait = 0 , NoLimit = INFINITE } |
typedef HANDLE | THandle |
Public Member Functions | |
TMutex (LPCTSTR name=nullptr, LPSECURITY_ATTRIBUTES sa=nullptr) | |
Constructs a TMutex instance encapsulating a newly created named or unnamed mutex object. | |
TMutex (const tstring &name, LPSECURITY_ATTRIBUTES sa=nullptr) | |
String-aware overload. | |
TMutex (LPCTSTR name, bool inherit, uint32 access=MUTEX_ALL_ACCESS) | |
Open an existing mutex. Fails if not there. | |
TMutex (const tstring &name, bool inherit, uint32 access=MUTEX_ALL_ACCESS) | |
String-aware overlaod. | |
TMutex (THandle handle) | |
Constructs a Tmutex instance encapsulating a handle obtained by duplicating the specified handle. | |
bool | IsShared () |
If another mutex with the same name existed when this mutex was created, then another handle to the object exists and someone else may be using it too. | |
Public Member Functions inherited from owl::TSemaphore | |
virtual | ~TSemaphore () |
operator THandle () const | |
Additional Inherited Members | |
Protected Attributes inherited from owl::TSemaphore | |
THandle | Handle |
Derived class must initialize. | |
Mutual-exclusive semaphore.
TMutex provides a system-independent interface to critical sections in threads. With suitable underlying implementations the same code can be used under OS/2 and Windows NT. An object of type TMutex can be used in conjunction with objects of type TMutex::TLock (inherited from TSemaphore) to guarantee that only one thread can be executing any of the code sections protected by the lock at any given time. The differences between the classes TCriticalSection and TMutex are that a timeout can be specified when creating a Lock on a TMutex object, and that a TMutex object has a HANDLE which can be used outside the class. This mirrors the distinction made in Windows NT between a CRITICALSECTION and a Mutex. Under NT a TCriticalSection object is much faster than a TMutex object. Under operating systems that don't make this distinction a TCriticalSection object can use the same underlying implementation as a TMutex, losing the speed advantage that it has under NT.
|
inline |
Constructs a TMutex instance encapsulating a newly created named or unnamed mutex object.
The name parameter points to a null-terminated string specifying the name of the mutex object. The sa parameter points to a SECURITY_ATTRIBUTES structure that specifies the security attributes of the mutex object.
Definition at line 1040 of file thread.h.
References owl::TSemaphore::Handle.
|
inline |
String-aware overload.
Definition at line 1051 of file thread.h.
References owl::TSemaphore::Handle.
|
inline |
Open an existing mutex. Fails if not there.
This form of the constructor instantiates a TMutex object that encapsulates an existing named mutex object. The name parameter points to a null-terminated string that names the mutex to be opened.
Definition at line 1065 of file thread.h.
References owl::TSemaphore::Handle.
|
inline |
String-aware overlaod.
Definition at line 1076 of file thread.h.
References owl::TSemaphore::Handle.
|
inline |
Constructs a Tmutex instance encapsulating a handle obtained by duplicating the specified handle.
The handle parameter is the source mutex object to be duplicated.
Definition at line 1090 of file thread.h.
References owl::TSemaphore::Handle.
|
inline |