TC::MT::Factory Namespace Reference
[Multithreading]

Factory for creating TC::MT objects. More...


Functions

ThreadPtr CreateThread (const std::string &thread_name, uint32 stack_size=0, Thread::ThreadPriority priority=Thread::PRIORITY_NORMAL)
 Create a thread object.
MessageDispatcherPtr CreateMessageDispatcher ()
 Create a message dispatcher object.
ThreadPtr GetCurrentThread ()
 Get The current thread object in which this command is executed.
MutexPtr CreateMutex (bool locked=false)
 Create a Mutex object.
MutexPtr CreateMutex (const std::string &shared_name, bool locked=false)
 Create a shared Mutex object with specified name.
EventPtr CreateEvent (bool manual_reset=false, bool initial_state=false)
 Construct an event object.
SemaphorePtr CreateSemaphore (uint32 initial_value)
 Construct an semaphore object.
SemaphorePtr CreateSemaphore (const std::string &shared_name, uint32 initial_value)
 Construct an shared semaphore object.
ConditionPtr CreateCondition ()
 construct a Condition variable
ConditionPtr CreateCondition (MutexPtr mutex)
 construct a Condition variable with an existing mutex


Detailed Description

Factory for creating TC::MT objects.


Function Documentation

ThreadPtr TC::MT::Factory::CreateThread ( const std::string &  thread_name,
uint32  stack_size = 0,
Thread::ThreadPriority  priority = Thread::PRIORITY_NORMAL 
)

Create a thread object.

When returning the thread is already in the running state

Parameters:
thread_name Name of the thread
stack_size Stack size of the thread 0 = system default stack size
priority Priority of the thread
See also:
ThreadPriority

MessageDispatcherPtr TC::MT::Factory::CreateMessageDispatcher (  ) 

Create a message dispatcher object.

See also:
TC::MT::MessageDispatcher

ThreadPtr TC::MT::Factory::GetCurrentThread (  ) 

Get The current thread object in which this command is executed.

MutexPtr TC::MT::Factory::CreateMutex ( bool  locked = false  ) 

Create a Mutex object.

For detailed description

See also:
TCMT::Mutex
Parameters:
locked true if the mutex should be already owned(locked)
Returns:
A shared pointer of the created mutex

MutexPtr TC::MT::Factory::CreateMutex ( const std::string &  shared_name,
bool  locked = false 
)

Create a shared Mutex object with specified name.

For detailed description

See also:
TCMT::Mutex
Parameters:
shared_name the name of the mutex so that it can be created inside other processes
locked true if the mutex should be already owned(locked)
Returns:
A shared pointer of the created mutex

Referenced by TC::MT::ObjectLevelLockable< CLASS_TO_LOCK >::ObjectLevelLockable().

Here is the caller graph for this function:

EventPtr TC::MT::Factory::CreateEvent ( bool  manual_reset = false,
bool  initial_state = false 
)

Construct an event object.

Parameters:
manual_reset True if the event hast to be reset manual after a wait
initial_state True to set the event at the beginning

SemaphorePtr TC::MT::Factory::CreateSemaphore ( uint32  initial_value  ) 

Construct an semaphore object.

Parameters:
initial_value The initial value of the semaphore

SemaphorePtr TC::MT::Factory::CreateSemaphore ( const std::string &  shared_name,
uint32  initial_value 
)

Construct an shared semaphore object.

Parameters:
shared_name the name of the mutex so that it can be created inside other processes
initial_value The initial value of the semaphore

ConditionPtr TC::MT::Factory::CreateCondition (  ) 

construct a Condition variable

The condition variable is linked a the mutex, so that there must be an implicit UnLock and Lock around Wait() and TryWait(). The Mutex can be obtained with GetMutex

ConditionPtr TC::MT::Factory::CreateCondition ( MutexPtr  mutex  ) 

construct a Condition variable with an existing mutex


Copyright (c) Thomas Goessler 2003 - 2008