Logo Search packages:      
Sourcecode: pwlib version File versions  Download package

Public Member Functions | Protected Member Functions | Private Member Functions | Private Attributes | Friends

PThread Class Reference

#include <thread.h>

Inheritance diagram for PThread:
Inheritance graph
[legend]
Collaboration diagram for PThread:
Collaboration graph
[legend]

List of all members.

Public Member Functions

void PXAbortBlock () const
int PXBlockOnChildTerminate (int pid, const PTimeInterval &timeout)
int PXBlockOnIO (int handle, int type, const PTimeInterval &timeout)
Overrides from PObject
void PrintOn (ostream &strm) const
Miscellaneous functions
virtual PObjectClone () const
virtual PINDEX HashFunction () 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

Construction

enum  Priority {
  LowestPriority, LowPriority, NormalPriority, HighPriority,
  HighestPriority, NumPriorities
}
 

Codes for thread priorities.

More...
enum  AutoDeleteFlag { AutoDeleteThread, NoAutoDeleteThread }
 

Codes for thread autodelete flag.

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)

Control functions

virtual void Restart ()
virtual void Terminate ()
virtual BOOL IsTerminated () const
void WaitForTermination () const
BOOL WaitForTermination (const PTimeInterval &maxWait) const
virtual void Suspend (BOOL susp=TRUE)
virtual void Resume ()
virtual BOOL IsSuspended () const
virtual void SetPriority (Priority priorityLevel)
virtual Priority GetPriority () const
virtual void SetAutoDelete (AutoDeleteFlag deletion=AutoDeleteThread)
void SetNoAutoDelete ()
virtual PString GetThreadName () const
virtual void SetThreadName (const PString &name)
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 PThreadIdentifier GetCurrentThreadId ()
static PThreadCurrent ()
static void Yield ()
static PThreadCreate (const PNotifier &notifier, INT parameter=0, AutoDeleteFlag deletion=AutoDeleteThread, Priority priorityLevel=NormalPriority, const PString &threadName=PString::Empty(), PINDEX stackSize=10000)

Run Time Type functions

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

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.


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

Generated by  Doxygen 1.6.0   Back to index