B2BITS FIX Antenna HFT  1.0.13
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Types | Public Member Functions | Static Public Member Functions | Protected Types | Protected Member Functions | List of all members
System::Thread Class Referenceabstract

A thread of execution in a program. More...

#include <Thread.h>

Public Types

typedef void(* ThreadListener )(Thread *pthread)
 

Public Member Functions

void cancel ()
 Requests that thread to be canceled. More...
 
bool equals (ThreadId thrId)
 
ThreadId getId () const
 Returns thread's id. More...
 
std::string const & getName () const
 Returns the thread's name. More...
 
void join ()
 Waits for this thread to terminate. More...
 
bool join (unsigned int miliseconds)
 Waits for this thread to terminate. More...
 
void setAffinity (u64 mask) throw ()
 Sets CPU affinity. More...
 
void setDestroyOnExit (bool needDestroyOnExit)
 Sets self-destroy thread mode Only has effect if called before start(). More...
 
void start ()
 Causes this thread to begin execution. More...
 
 Thread (bool setExTranslator=true)
 Constructor. More...
 
 Thread (const char *pName, bool setExTranslator=true)
 Constructor. More...
 
 Thread (std::string aName, bool setExTranslator=true)
 
virtual ~Thread ()
 Destructor. More...
 

Static Public Member Functions

static void callThreadStartListener (System::Thread *pthread) throw ()
 
static void callThreadStopListener (System::Thread *pthread) throw ()
 
static ThreadListener getThreadStartListener () throw ()
 
static ThreadListener getThreadStopListener () throw ()
 
static ThreadId self ()
 Returns the thread ID of the calling thread. More...
 
static void setCurrentThreadAffinity (u64 mask)
 
static void setName (char const *name)
 Gives name to the current thread. More...
 
static bool setRealtime (u64 realtimePrio)
 
static void setThreadStartListener (ThreadListener listener) throw ()
 
static void setThreadStopListener (ThreadListener listener) throw ()
 
static bool sleep (unsigned int aMillis)
 Causes the currently executing thread to sleep for the specified number of milliseconds. More...
 
static void yield ()
 Causes the currently executing thread object to temporarily pause and allow other threads to execute. More...
 

Protected Types

enum  CancellationType { DISABLED, DEFERRED, ASYNCHRONOUS }
 

Protected Member Functions

virtual void run ()=0
 Thread's start function. More...
 
void setCancelMode (CancellationType aMode)
 Sets thread's cancellation mode. More...
 

Detailed Description

A thread of execution in a program.

Member Typedef Documentation

typedef void( * System::Thread::ThreadListener)(Thread *pthread)

Member Enumeration Documentation

Enumerator
DISABLED 
DEFERRED 
ASYNCHRONOUS 

Constructor & Destructor Documentation

System::Thread::Thread ( bool  setExTranslator = true)
explicit

Constructor.

When a new thread is created, it does not begin immediate execution.

Parameters
setExTranslator- valid for the Windows platform only. When true SEH exceptions will be translated into the Utils::Exception.
Exceptions
SystemException
See Also
start()
System::Thread::Thread ( const char *  pName,
bool  setExTranslator = true 
)
explicit

Constructor.

When a new thread is created, it does not begin immediate execution.

Parameters
setExTranslator- valid for the Windows platform only. When true SEH exceptions will be translated into the Utils::Exception.
Exceptions
SystemException
See Also
start()
System::Thread::Thread ( std::string  aName,
bool  setExTranslator = true 
)
explicit
virtual System::Thread::~Thread ( )
virtual

Destructor.

Member Function Documentation

static void System::Thread::callThreadStartListener ( System::Thread pthread)
throw (
)
inlinestatic
static void System::Thread::callThreadStopListener ( System::Thread pthread)
throw (
)
inlinestatic
void System::Thread::cancel ( )

Requests that thread to be canceled.

Cancellation is asynchronous. Use join() to wait for termination of thread if necessary. You should never use cancellation unless you really want the target thread to go away. This is a termination mechanism.

Exceptions
SystemException
See Also
"cancellation (3THR)"
bool System::Thread::equals ( ThreadId  thrId)
Returns
True if thread IDs equals, false otherwise.
ThreadId System::Thread::getId ( ) const
inline

Returns thread's id.

std::string const& System::Thread::getName ( ) const
inline

Returns the thread's name.

static ThreadListener System::Thread::getThreadStartListener ( )
throw (
)
static

Referenced by callThreadStartListener().

static ThreadListener System::Thread::getThreadStopListener ( )
throw (
)
static

Referenced by callThreadStopListener().

void System::Thread::join ( )

Waits for this thread to terminate.

Exceptions
SystemException
bool System::Thread::join ( unsigned int  miliseconds)

Waits for this thread to terminate.

- timeout in miliseconds

Exceptions
SystemException
virtual void System::Thread::run ( )
protectedpure virtual

Thread's start function.

Subclasses of Thread should override this method.

static ThreadId System::Thread::self ( )
static

Returns the thread ID of the calling thread.

void System::Thread::setAffinity ( u64  mask)
throw (
)

Sets CPU affinity.

There is no waranty for this method.

void System::Thread::setCancelMode ( CancellationType  aMode)
protected

Sets thread's cancellation mode.

Exceptions
SystemException
static void System::Thread::setCurrentThreadAffinity ( u64  mask)
static
void System::Thread::setDestroyOnExit ( bool  needDestroyOnExit)

Sets self-destroy thread mode Only has effect if called before start().

static void System::Thread::setName ( char const *  name)
static

Gives name to the current thread.

Parameters
nameNew name
static bool System::Thread::setRealtime ( u64  realtimePrio)
static
static void System::Thread::setThreadStartListener ( ThreadListener  listener)
throw (
)
static
static void System::Thread::setThreadStopListener ( ThreadListener  listener)
throw (
)
static
static bool System::Thread::sleep ( unsigned int  aMillis)
static

Causes the currently executing thread to sleep for the specified number of milliseconds.

It is a cancellation point.

Returns
true if the method was interrupted by a signal, false otherwise.
Exceptions
SystemException
void System::Thread::start ( )

Causes this thread to begin execution.

Exceptions
SystemException
static void System::Thread::yield ( )
static

Causes the currently executing thread object to temporarily pause and allow other threads to execute.

Exceptions
SystemException