API Guides > ConceptRT 3.x
Thread Class Referenceabstract

Abstraction of a thread. More...

Detailed Description

Abstraction of a thread.

+ Inheritance diagram for Thread:

Public Member Methods

 Thread (Int32 stackSize=DefaultStackSize)
 Constructor. More...
 
 Thread (PCChar8 name, Int32 stackSize=DefaultStackSize)
 Constructor. More...
 
void SetName (PCChar8 name)
 Sets the thread name. More...
 
virtual ~Thread ()
 Destructor. More...
 
const StringGetName ()
 Gets the thread name. More...
 
void Suspend ()
 Suspends the thread. More...
 
void Resume ()
 Resumes the thread. More...
 
Int32 GetThreadID ()
 Gets the thread identifier. More...
 
bool WaitFor (TimeSpan timeOut=TimeInfinite)
 Wait for. More...
 
bool GetIsTerminated ()
 Query if the thread is suspended. More...
 
bool GetIsSuspended ()
 Query if the thread is suspended. More...
 
bool GetIsCurrentThread ()
 Query if this object is current thread. More...
 
void CheckCurrentThread ()
 Check current thread. Check if a the caller of a method of this thread is done outside the owning thread. If not exception is raised. More...
 
Int32 GetStackSize ()
 Gets the stack size. More...
 
Int32 GetStackUsed ()
 Gets the stack used. More...
 
Int32 GetStackAvailable ()
 Gets the stack availability. More...
 
void SetPriority (ThreadPriority priority)
 Sets the priority. More...
 
ThreadPriority GetPriority ()
 Gets the priority. More...
 
bool GetIsTimeCritical ()
 Query if is it a time critical thread. More...
 
void SetIsTimeCritical (bool value)
 Sets the thread as time critical. More...
 
void SetHasViolatedTimeCritical ()
 Sets the flag saying that it has violated its time critical feature. More...
 
bool HasViolatedTimeCritical ()
 Query if the tread has violated its time critical feature. More...
 
void ResetHasViolatedTimeCritical ()
 Reset the flag saying that it has violated its time critical feature. More...
 
bool GetIsAllowedBlockingCode ()
 Query if the thread has the permission to call blocking code. More...
 
void SetBlockingCodePermission (bool permission)
 Sets the thread permission to call blocking code. More...
 
void SetHasViolatedBlockingCodePermission ()
 Sets the flag saying that it has violated its blocking code permission. More...
 
bool HasViolatedBlockingCodePermission ()
 Query if the tread has violated its blocking code permission. More...
 
void ResetHasViolatedBlockingCodePermission ()
 Reset the flag saying that it has violated its blocking code permission. More...
 
void SetThreadListener (IThreadSectionWaitListener &threadListener)
 Sets the thread listener. More...
 
IThreadSectionWaitListenerGetThreadListener ()
 Gets the thread listener. More...
 

Protected Member Functions

virtual void Execute ()=0
 The execution of the tread. More...
 
void InternalExecute ()
 Internal execution and preparation of the thread before executing Execute. More...
 

Constructor & Destructor Documentation

Thread ( Int32  stackSize = DefaultStackSize)

Constructor.

Parameters
stackSize(optional) size of the stack. Default = DefaultStackSize.
Warning
Non-Deterministic. Determinism when using ConceptRT library can be ensure by using Context Time Critical mechanisms.
Thread ( PCChar8  name,
Int32  stackSize = DefaultStackSize 
)

Constructor.

Parameters
nameName of the thread.
stackSize(optional) size of the stack. Default = DefaultStackSize.
Warning
Non-Deterministic. Determinism when using ConceptRT library can be ensure by using Context Time Critical mechanisms.
virtual ~Thread ( )
virtual

Destructor.

Methods Documentation

void CheckCurrentThread ( )

Check current thread. Check if a the caller of a method of this thread is done outside the owning thread. If not exception is raised.

virtual void Execute ( )
protectedpure virtual

The execution of the tread.

This method is called once the thread is Resumed, initialized and ready to execute.

Implemented in ServiceControllerThread, and SyncPersistenceThread.

bool GetIsAllowedBlockingCode ( )
inline

Query if the thread has the permission to call blocking code.

Returns
true if it is, false if not.
Version
3.3 or greater feature.
bool GetIsCurrentThread ( )

Query if this object is current thread.

Returns
true if current thread, false if not.
bool GetIsSuspended ( )

Query if the thread is suspended.

Returns
true if it is suspended, false if not.
bool GetIsTerminated ( )

Query if the thread is suspended.

Returns
true if it is suspended, false if not.
bool GetIsTimeCritical ( )
inline

Query if is it a time critical thread.

Returns
true if it is, false if not.
const String& GetName ( )

Gets the thread name.

Returns
The thread name.
Version
3.3 or greater feature.
ThreadPriority GetPriority ( )

Gets the priority.

Returns
The priority.
Int32 GetStackAvailable ( )

Gets the stack availability.

Returns
The stack available.
Int32 GetStackSize ( )

Gets the stack size.

Returns
The stack size.
Int32 GetStackUsed ( )

Gets the stack used.

Returns
The stack used.
Int32 GetThreadID ( )

Gets the thread identifier.

Returns
The thread identifier.
IThreadSectionWaitListener* GetThreadListener ( )

Gets the thread listener.

Returns
The threadListener.
bool HasViolatedBlockingCodePermission ( )
inline

Query if the tread has violated its blocking code permission.

Returns
true if it has, false if not.
Version
3.3 or greater feature.
bool HasViolatedTimeCritical ( )
inline

Query if the tread has violated its time critical feature.

Returns
true if it has, false if not.
Version
3.3 or greater feature.
void InternalExecute ( )
protected

Internal execution and preparation of the thread before executing Execute.

void ResetHasViolatedBlockingCodePermission ( )
inline

Reset the flag saying that it has violated its blocking code permission.

Version
3.3 or greater feature.
void ResetHasViolatedTimeCritical ( )
inline

Reset the flag saying that it has violated its time critical feature.

Version
3.3 or greater feature.
void Resume ( )

Resumes the thread.

void SetBlockingCodePermission ( bool  permission)
inline

Sets the thread permission to call blocking code.

Parameters
permissiontrue to allow, false if not.

By default the thead has the persimission to call blocking code.

Version
3.3 or greater feature.
void SetHasViolatedBlockingCodePermission ( )
inline

Sets the flag saying that it has violated its blocking code permission.

Version
3.3 or greater feature.
void SetHasViolatedTimeCritical ( )
inline

Sets the flag saying that it has violated its time critical feature.

Version
3.3 or greater feature.
void SetIsTimeCritical ( bool  value)
inline

Sets the thread as time critical.

Parameters
valuetrue to value.
void SetName ( PCChar8  name)

Sets the thread name.

Parameters
nameName of the thread.
Warning
Calling this method after Resume will change the thread name only locally. Thus the name may be not changed in underneath OS object (for debug purpose).
Version
3.4 or greater feature.
void SetPriority ( ThreadPriority  priority)

Sets the priority.

Parameters
priorityThe priority.
void SetThreadListener ( IThreadSectionWaitListener threadListener)

Sets the thread listener.

Parameters
threadListenerThe threadListener.
RT Exceptions:
RT_ERROR_SET_LISTENER_ON_RESUMED_THREAD
void Suspend ( )

Suspends the thread.

bool WaitFor ( TimeSpan  timeOut = TimeInfinite)

Wait for.

Parameters
timeOut(optional) the time out. Default = TimeInfinite
Returns
true if it succeeds, false if a timeout occurs.