Logo Search packages:      
Sourcecode: pwlib version File versions

PThread Class Reference

#include <thread.h>

Inheritance diagram for PThread:

PObject DelayThread LauncherThread PProcess UserInterfaceThread UserInterfaceThread PServiceProcess

List of all members.


Detailed Description

This class defines a thread of execution in the system. A { thread} is an independent flow of processor instructions. This differs from a { process} which also embodies a program address space and resource allocation. So threads can share memory and resources as they run in the context of a given process. A process always contains at least one thread. This is reflected in this library by the PProcess# class being descended from the PThread class.

The implementation of a thread is platform dependent, but it is assumed that the platform has some support for native threads. Previous versions of PWLib has some support for co-operative threads, but this has been removed

Definition at line 190 of file thread.h.


Construction

enum  AutoDeleteFlag { AutoDeleteThread, NoAutoDeleteThread }
 Codes for thread autodelete flag. More...
enum  Priority {
  LowestPriority, LowPriority, NormalPriority, HighPriority,
  HighestPriority, NumPriorities
}
 Codes for thread priorities. More...
 PThread (PINDEX, AutoDeleteFlag deletion=AutoDeleteThread, Priority priorityLevel=NormalPriority, const PString &threadName=PString::Empty())
 ~PThread ()

Comparison functions

enum  Comparison { LessThan = -1, EqualTo = 0, GreaterThan = 1 }
virtual Comparison Compare (const PObject &obj) const
virtual Comparison CompareObjectMemoryDirect (const PObject &obj) const
bool operator!= (const PObject &obj) const
bool operator< (const PObject &obj) const
bool operator<= (const PObject &obj) const
bool operator== (const PObject &obj) const
bool operator> (const PObject &obj) const
bool operator>= (const PObject &obj) const

I/O functions

ostream & operator<< (ostream &strm, const PObject &obj)
istream & operator>> (istream &strm, PObject &obj)
virtual void ReadFrom (istream &strm)

Run Time Type functions

virtual const char * GetClass (unsigned=0) const
virtual BOOL InternalIsDescendant (const char *clsName) const
BOOL IsClass (const char *cls) const
static const char * Class ()

Control functions

virtual Priority GetPriority () const
virtual PString GetThreadName () const
virtual BOOL IsSuspended () const
virtual BOOL IsTerminated () const
virtual void Restart ()
virtual void Resume ()
virtual void SetAutoDelete (AutoDeleteFlag deletion=AutoDeleteThread)
void SetNoAutoDelete ()
virtual void SetPriority (Priority priorityLevel)
virtual void SetThreadName (const PString &name)
virtual void Suspend (BOOL susp=TRUE)
virtual void Terminate ()
BOOL WaitForTermination (const PTimeInterval &maxWait) const
void WaitForTermination () const
static void Sleep (const PTimeInterval &delay)
 Suspend the current thread for the specified amount of time.

Miscellaneous

virtual PThreadIdentifier GetThreadId () const
virtual void Main ()=0
static PThreadCreate (const PNotifier &notifier, INT parameter=0, AutoDeleteFlag deletion=AutoDeleteThread, Priority priorityLevel=NormalPriority, const PString &threadName=PString::Empty(), PINDEX stackSize=10000)
static PThreadCurrent ()
static PThreadIdentifier GetCurrentThreadId ()
static void Yield ()

Public Member Functions

void PXAbortBlock () const
int PXBlockOnChildTerminate (int pid, const PTimeInterval &timeout)
int PXBlockOnIO (int handle, int type, const PTimeInterval &timeout)
Miscellaneous functions
virtual PObjectClone () const
virtual PINDEX HashFunction () const
Overrides from PObject
void PrintOn (ostream &strm) const

Protected Member Functions

void InitialiseProcessThread ()

Private Member Functions

PThreadoperator= (const PThread &)
 PCLASSINFO (PThread, PObject)
 PThread (const PThread &)

Private Attributes

BOOL autoDelete
PString threadName
unsigned traceBlockIndentLevel

Friends

class PProcess
class PTrace::Block

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

Generated by  Doxygen 1.6.0   Back to index