Om  1.0.0
A universal framework for multimedia simulation
Classes | Public Member Functions | Static Public Member Functions | Protected Member Functions | List of all members
om::threads::FunctionThread< Signature > Class Template Reference

A class that provides a function-based interface for creating threads. More...

#include <omThread.h>

Inheritance diagram for om::threads::FunctionThread< Signature >:
om::threads::ThreadBase

Classes

class  ReturnValueWrapper
 A class that is used to facilitate accessing the return values of function threads. More...
 
class  ReturnValueWrapper< Sig, void >
 A class specialization that is used to handle void return values of function threads. More...
 

Public Member Functions

 FunctionThread ()
 Create a default thread with no runnable to execute. More...
 
 ~FunctionThread ()
 Destroy and clean up the thread, stopping it if necessary. More...
 
void start (const lang::FunctionCall< Signature > &functionCall)
 Start the execution of a thread using the specified function call. More...
 
lang::Optional< typename lang::FunctionCall< Signature >::ReturnType > join ()
 
- Public Member Functions inherited from om::threads::ThreadBase
 ThreadBase ()
 Create a default thread that is not yet running. More...
 
 ThreadBase (const ThreadBase &other)
 Create a new thread that is a copy of another thread. More...
 
virtual ~ThreadBase ()
 Destroy this thread object. More...
 
ThreadBaseoperator= (const ThreadBase &other)
 Copy the attributes of one thread to this thread. More...
 
Bool stop ()
 Forcibly end the execution of a thread. More...
 
Bool isRunning () const
 Get whether or not a thread is currently running. More...
 
ThreadID getID () const
 Return the ID of this thread. More...
 
ThreadPriority getPriority (const ThreadPriority &newPriority)
 Return an object describing the current scheduling priority for this thread. More...
 
Bool setPriority (const ThreadPriority &newPriority)
 Set the scheduling priority for this thread. More...
 

Static Public Member Functions

static void sleep (int milliseconds)
 Sleep the calling thread for the specified number of milliseconds. More...
 
static void sleep (double seconds)
 Sleep the calling thread for the specified number of seconds. More...
 
static void yield ()
 Relinquish the calling thread's CPU time until it's rescheduled. More...
 
static void exit ()
 Terminate the current calling thread. More...
 
- Static Public Member Functions inherited from om::threads::ThreadBase
static void sleepMs (UInt milliseconds)
 Sleep the calling thread for the specified number of milliseconds. More...
 
static void sleep (double seconds)
 Sleep this thread for the specified number of seconds. More...
 
static void yield ()
 Relinquish the calling thread's CPU time until is it rescheduled. More...
 
static void exit ()
 Terminate the current calling thread. More...
 
static ThreadID getCurrentID ()
 Return the ID of the calling thread. More...
 

Protected Member Functions

virtual void run ()
 Start the execution of subclass client code on a new thread. More...
 
- Protected Member Functions inherited from om::threads::ThreadBase
Bool startThread ()
 Start this thread object's execution. More...
 
Bool joinThread ()
 Wait indefinitely to join a thread when it dies. More...
 

Detailed Description

template<typename Signature>
class om::threads::FunctionThread< Signature >

A class that provides a function-based interface for creating threads.

Constructor & Destructor Documentation

template<typename Signature>
om::threads::FunctionThread< Signature >::FunctionThread ( )
inline

Create a default thread with no runnable to execute.

template<typename Signature>
om::threads::FunctionThread< Signature >::~FunctionThread ( )
inline

Destroy and clean up the thread, stopping it if necessary.

Member Function Documentation

template<typename Signature>
void om::threads::FunctionThread< Signature >::start ( const lang::FunctionCall< Signature > &  functionCall)
inline

Start the execution of a thread using the specified function call.

This method creates a new thread if the thread is not already running and calls the specified function call object. When the function call returns, the thread exits.

Parameters
functionCall- a function call that should be executed on the other thread.
template<typename Signature>
lang::Optional<typename lang::FunctionCall<Signature>::ReturnType> om::threads::FunctionThread< Signature >::join ( )
inline
template<typename Signature>
static void om::threads::FunctionThread< Signature >::sleep ( int  milliseconds)
inlinestatic

Sleep the calling thread for the specified number of milliseconds.

template<typename Signature>
static void om::threads::FunctionThread< Signature >::sleep ( double  seconds)
inlinestatic

Sleep the calling thread for the specified number of seconds.

template<typename Signature>
static void om::threads::FunctionThread< Signature >::yield ( )
inlinestatic

Relinquish the calling thread's CPU time until it's rescheduled.

template<typename Signature>
static void om::threads::FunctionThread< Signature >::exit ( )
inlinestatic

Terminate the current calling thread.

template<typename Signature>
virtual void om::threads::FunctionThread< Signature >::run ( )
inlineprotectedvirtual

Start the execution of subclass client code on a new thread.

Implements om::threads::ThreadBase.


The documentation for this class was generated from the following file: