25#if !defined(OWL_THREAD_H)
29#if defined(BI_HAS_PRAGMA_ONCE)
35#if !defined(BI_MULTI_THREAD)
36#error Thread classes require multi-threaded operating system.
43#if defined(BI_MULTI_THREAD_RTL)
79 bool WasAquired()
const;
141 virtual void Release();
166 virtual void Release();
192 virtual void Release();
204#if !defined(CreateWaitableTimer)
222 virtual void Release();
249 int GetCount()
const;
265 bool WasAquired()
const;
272 int WhichAquired()
const;
286 void Release(
int index = -1);
626 virtual void Terminate();
630 TStatus GetStatus()
const;
631 uint32 GetExitCode()
const;
643 int GetPriority()
const;
644 int SetPriority(
int);
687 bool ShouldTerminate()
const;
695#if defined(BI_MULTI_THREAD_RTL)
704 bool TerminationRequested;
708#if defined(BI_MULTI_THREAD_RTL)
792 return p ? *p : Create();
798 const T*
Query()
const
809#if defined(OWL5_COMPAT)
836 T* p =
new T();
CHECK(p);
847 static void Delete(T* p)
864#if defined(OWL5_COMPAT)
879 return index < (
int)Data.Size() ? Data[index] : 0;
895 bool IsOk() {
return index != 0xFFFFFFFF; }
896 bool SetValue(
void*
value) { return ::TlsSetValue(index,
value); }
897 void* GetValue() { return ::TlsGetValue(index); }
912 TMRSWSection::TLock
__lock(Lock,
false,
true);
934 TMRSWSection::TLock
__lock(Lock,
false,
true);
961 inline operator T*() {
return GetData(); }
962 inline operator T&() {
return *GetData();}
963 inline T* operator->(){
return GetData(); }
1015 return Sem !=
nullptr;
1229 return (index >= 0 && index < Count) ? Sems[index] :
nullptr;
1235 return Set !=
nullptr;
1345 return sync->CritSec;
1414 if (Stat == Running)
1415 Stat = CheckStatus();
1433 return ::GetThreadPriority(Handle);
1444 return TerminationRequested;
#define DIAG_DECLARE_GROUP(group)
#define TRACEX(group, level, message)
Counted semaphore. Currently Win32 only.
TCountedSemaphore(int initialCount, int maxCount, LPCTSTR name=nullptr, LPSECURITY_ATTRIBUTES sa=nullptr)
This nested class handles locking and unlocking critical sections.
TLock(const TCriticalSection &)
Use system call to lock the CRITICAL_SECTION object.
~TLock()
Use system call to unlock the CRITICAL_SECTION object.
Lightweight intra-process thread synchronization.
TCriticalSection()
Use system call to initialize the CRITICAL_SECTION object.
TLock Lock
For compatibility with old T-less typename.
~TCriticalSection()
Use system call to destroy the CRITICAL_SECTION object.
TEventSemaphore(bool manualReset=false, bool initialState=false, LPCTSTR name=nullptr, LPSECURITY_ATTRIBUTES sa=nullptr)
TFileTime is a class derived from the structure FILETIME.
Multiple Read, Single Write section.
Mutual-exclusive semaphore.
TMutex(LPCTSTR name=nullptr, LPSECURITY_ATTRIBUTES sa=nullptr)
Constructs a TMutex instance encapsulating a newly created named or unnamed mutex object.
TLock Lock
For compatibility with old T-less typename.
bool IsShared()
If another mutex with the same name existed when this mutex was created, then another handle to the o...
TLock(const TSemaphore &, ulong timeOut=NoLimit, bool alertable=false)
void Release(bool relinquish=false)
Release lock early & relinquish, i.e.
bool WasAquired() const
See if really aquired, or just timed-out.
Base class for handle-based thread synchronization classes, TMutex, TCountedSemaphore and TEventSemap...
THandle Handle
Derived class must initialize.
virtual void Release()=0
Derived class must provide release.
int WhichAquired() const
See which was aquired >=0, or enum.
bool WasAquired() const
See if one or more was aquired.
Semaphore object aggregator.
const TSemaphore * operator[](int index) const
Provides class-specific operator new and operator delete that simply call the global operator new and...
TStaticSync provides a system-independent interface to build sets of classes that act somewhat like m...
const TStaticSync< T > & operator=(const TStaticSync< T > &)
TLock Lock
For compatibility with old T-less typename.
This nested class handles locking and unlocking critical sections.
TLock(const TSync *)
Locks the TCriticalSection object in the TSync object.
TSync provides a system-independent interface to build classes that act like monitors,...
const TSync & operator=(const TSync &)
Does not copy the TCriticalSection object, since the new object is not being used in any of its own m...
TSync()
Default constructor.
TLock Lock
For compatibility with old T-less typename.
The error class that defines the objects that are thrown when an error occurs.
TErrorType
Identifies the type of error that occurred.
@ SuspendBeforeRun
The user called Suspend() on an object before calling Start().
@ AssignError
An attempt was made to assign to an object that was not in either the Created or the Finished state.
@ ResumeBeforeRun
The user called Resume() on an object before calling Start().
@ DestroyBeforeExit
The object's destructor was invoked its thread had exited.
@ ResumeDuringRun
The user called Resume() on a thread that was not Suspended.
@ SuspendAfterExit
The user called Suspend() on an object whose thread had already exited.
@ CreationFailure
The operating system was unable to create the thread.
@ ResumeAfterExit
The user called Resume() on an object whose thread had already exited.
TErrorType GetErrorType() const
Returns a code indicating the type of error that occurred.
TThread provides a system-independent interface to threads.
uint32 GetExitCode() const
TStatus GetStatus() const
Gets the current status of the thread.
int GetPriority() const
Gets the thread priority.
TStatus Status
For compatibility with old T-less typenames.
bool ShouldTerminate() const
Returns a bool value to indicate that Terminate() or TerminateAndWait() has been called.
bool Sleep(long timeMS, bool alertable=false)
Suspends execution of the current thread for the number of milliseconds specified by the timeMS param...
TStatus
Identifies the states that the class can be in.
@ Created
The class has been created but the thread has not been started.
@ Finished
The thread has finished execution.
@ Suspended
The thread has been suspended.
@ Running
The thread is running.
virtual ~TWaitableTimer()
TWaitableTimer(bool manualReset=false, LPCTSTR name=nullptr, LPSECURITY_ATTRIBUTES sa=nullptr)
Derived from xmsg, TXBase is the base class for ObjectWindows and ObjectComponents exception-handling...
Base exception support for framework exceptions.
VOID(APIENTRY * PTIMERAPCROUTINE)(LPVOID lpArgToCompletionRoutine, DWORD dwTimerLowValue, DWORD dwTimerHighValue)
Encapsulation of Waitable Timer over Borland Classlib TSemaphore hierarchy.
Object Windows Library (OWLNext Core)
void InUse(const T &arg)
Handy utility to avoid compiler warnings about unused parameters.
General definitions used by all ObjectWindows programs.
#define CONST_CAST(targetType, object)
Definition of container classes used and made available by OWL.
Classes for window system structure and type encapsulation.