Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

phThread Class Reference
[Threading and SynchronizationThread Safe]

#include <phThread.h>

Inheritance diagram for phThread:

phCondition phMutex phObject phCaptureInterface phClientHandler phClientListener phDisplayInterface phEffectsThread phEffectsThread phEffectsThread phImageWindow phJoystickControl phLinuxJoystick phNetClientRecvThread phNetClientThread phNodeComm phPipeline phPlayerClient phRWLockThread phServerThread phSonarHandler phThreadClassOne phThreadClassThree phThreadClassTwo phWander List of all members.

Detailed Description

C++ wrapper class for threading.

A phThread should always be allocated with the new operator. Allocating a thread class on the stack s possible but if it is meant to be a detached thread it can lead to an attempt at deleting stack memory which will likely segfault the process.

Phission implements it's own C++ thread to be able to port to any unsupported thread API. It started off as being a simple wrapper around pthreads and was refined to be a union of Win32 threads and pthread ideas. The resulting phThread interface lent itself very easily to being ported to the VisualDSP++ Kernel thread API.

Phission's design is centered heavily on the idea of many specific purpose threads. It was very necessary to have a custom thread class to be sure everything about the system was designed with certain features.

Phission doesn't allow the 'canceling' of threads because it is bad coding practice to stop a thread dead in it's tracks without having that thread clean up or release it's allocated resources.

The Phission thread implementation adds specific methods that are not available in other thread implementations. These include the following methods which should not be called by any code:

The following methods (including those mentioned above) should not be called by a spawned thread on it's own phThread class instance:

The phThread::exit method can only be called from the current thread's phThread instance.

Definition at line 154 of file phThread.h.

Public Member Functions

 phThread ()
virtual ~phThread ()
int start (int flag=phNOFLAG)
int stop ()
int threadStopped ()
int isRunning ()
void setRunning (int running)
uint32_t id ()
int32_t getReturnCode ()
int detach ()
int detached ()
int setPriority (int priority, int flag)
int getPriority ()
int getPriorityFlag ()
void exit (uint32_t value=0)
int equal (phThread &thread)
int signal_running ()
int signal_error ()

Static Public Member Functions

static int same (phThread &thread_one, phThread &thread_two)
static void forcedExit ()

Protected Member Functions

virtual int run ()
virtual int setup ()
virtual int wakeup ()
virtual int cleanup ()
virtual int error ()

Static Private Member Functions

static void * entry (void *param)

Private Attributes

ph_thread_info m_info
int m_ready
int32_t m_returned
int m_detached
volatile int m_running
volatile int m_error
volatile int m_joining

Friends

class phWrapperThread


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



Copyright (C) 2002 - 2007 Philip D.S. Thoren ( pthoren@users.sourceforge.net )
University Of Massachusetts at Lowell
Robotics Lab
SourceForge.net Logo

Generated on Sat Jun 16 02:45:15 2007 for phission by  doxygen 1.4.4