library of assembled shared sources

http://lass.cocamware.com

lass::util::Thread Class Reference
[Threading]

A base class for threads. More...

#include <thread.h>

Inheritance diagram for lass::util::Thread:

Inheritance graph
[legend]
Collaboration diagram for lass::util::Thread:

Collaboration graph
[legend]

Public Types

enum  { anyProcessor = unsigned(-1) }

Public Member Functions

virtual ~Thread ()
void run ()
void join ()
void bind (unsigned processor)
 bind this thread to a processor (this as in this-pointer)

Static Public Member Functions

static void sleep (unsigned long milliseconds)
static void yield ()
static void bindCurrent (unsigned processor)
 bind current thread to a processor (current as in callee's context)

Protected Member Functions

 Thread (ThreadKind kind=threadDetached, const char *name=0)

Private Member Functions

virtual void doRun ()=0
void swap (NonCopyable &)

Private Attributes

impl::ThreadInternalpimpl_

Friends

class impl::ThreadInternal

Detailed Description

A base class for threads.

The virtual function doRun() needs to be overriden and after creation of the thread on the heap or stack, the thread is in a state ready to be run. The run() function actually starts the thread.

JOINABLE threads can be waited for, DETACHED threads can not be waited for.

Definition at line 191 of file thread.h.


Member Enumeration Documentation

anonymous enum

Enumerator:
anyProcessor  argument for Thread::bind to unbind the thread so it runs on any processor

Definition at line 195 of file thread.h.


Constructor & Destructor Documentation

lass::util::Thread::~Thread (  )  [virtual]

Definition at line 208 of file thread.cpp.

References pimpl_.

lass::util::Thread::Thread ( ThreadKind  kind = threadDetached,
const char *  name = 0 
) [protected]

Definition at line 203 of file thread.cpp.

References pimpl_.


Member Function Documentation

void lass::util::Thread::run (  ) 

void lass::util::Thread::join (  ) 

void lass::util::Thread::bind ( unsigned  processor  ) 

bind this thread to a processor (this as in this-pointer)

Definition at line 228 of file thread.cpp.

References lass::util::impl::ThreadInternal::bind(), LASS_ASSERT, and pimpl_.

Referenced by lass::util::ThreadPool< TaskType, ConsumerType, IdlePolicy, ParticipationPolicy >::startThreads().

void lass::util::Thread::sleep ( unsigned long  milliseconds  )  [static]

Definition at line 234 of file thread.cpp.

void lass::util::Thread::yield (  )  [static]

Definition at line 239 of file thread.cpp.

void lass::util::Thread::bindCurrent ( unsigned  processor  )  [static]

virtual void lass::util::Thread::doRun (  )  [private, pure virtual]

void lass::util::NonCopyable::swap ( NonCopyable  )  [inline, protected, inherited]

Definition at line 60 of file non_copyable.h.

Referenced by lass::io::Image::readLine().


Friends And Related Function Documentation

friend class impl::ThreadInternal [friend]

Definition at line 216 of file thread.h.


Field Documentation

Definition at line 220 of file thread.h.

Referenced by bind(), join(), run(), Thread(), and ~Thread().


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

Generated on Mon Nov 10 14:22:17 2008 for Library of Assembled Shared Sources by doxygen 1.5.7.1
SourceForge.net Logo