PTLib  Version 2.14.3
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
PLibraryProcess Class Reference

Class for a process that is a dynamically loaded library. More...

#include <pprocess.h>

Inheritance diagram for PLibraryProcess:
Collaboration diagram for PLibraryProcess:

Public Member Functions

virtual void Main ()
 < Dummy Main() as libraries do not have one. More...
 
Construction
 PLibraryProcess (const char *manuf="", const char *name="", unsigned majorVersionNum=1, unsigned minorVersionNum=0, CodeStatus statusCode=ReleaseCode, unsigned buildNum=1, bool suppressStartup=false)
 Create a new process instance. More...
 
- Public Member Functions inherited from PProcess
void PreInitialise (int argc, char **argv)
 Internal initialisation function called directly from InternalMain(). More...
 
void PreShutdown ()
 Internal shutdown function called directly from the ~PProcess InternalMain(). More...
 
virtual int InternalMain (void *arg=NULL)
 Main function for process, called from real main after initialisation. More...
 
PThreadGetThread (PThreadIdentifier threadId) const
 
bool SignalTimerChange ()
 
 ~PProcess ()
 
virtual void PXOnSignal (int)
 
virtual void PXOnAsyncSignal (int)
 
void PXCheckSignals ()
 
Comparison Compare (const PObject &obj) const
 Compare two process instances. More...
 
virtual void Terminate ()
 Terminate the process. More...
 
 PProcess (const char *manuf="", const char *name="", unsigned majorVersion=1, unsigned minorVersion=0, CodeStatus status=ReleaseCode, unsigned buildNumber=1, bool library=false, bool suppressStartup=false)
 Create a new process instance. More...
 
void Startup ()
 Start up all items registered with PProcessStartupFactory. More...
 
virtual void OnThreadStart (PThread &thread)
 Callback for when a thread is started by the PTLib system. More...
 
virtual void OnThreadEnded (PThread &thread)
 Callback for when a thread is ended if wqas started in the PTLib system. More...
 
virtual bool OnInterrupt (bool terminating)
 Callback for when a ^C (SIGINT), hangup (SIGHUP) or termination request (SIGTERM) is received by process. More...
 
void SetTerminationValue (int value)
 Set the termination value for the process. More...
 
int GetTerminationValue () const
 Get the termination value for the process. More...
 
PArgListGetArguments ()
 Get the programme arguments. More...
 
virtual const PStringGetManufacturer () const
 Get the name of the manufacturer of the software. More...
 
virtual const PStringGetName () const
 Get the name of the process. More...
 
virtual PString GetVersion (PBoolean full=true) const
 Get the version of the software. More...
 
const PFilePathGetFile () const
 Get the processes executable image file path. More...
 
PProcessIdentifier GetProcessID () const
 Get the platform dependent process identifier for the process. More...
 
PTime GetStartTime () const
 Return the time at which the program was started. More...
 
PString GetUserName () const
 Get the effective user name of the owner of the process, eg "root" etc. More...
 
PBoolean SetUserName (const PString &username, PBoolean permanent=false)
 Set the effective owner of the process. More...
 
PDirectory GetHomeDirectory () const
 Get the "home" directory for the logged in user. More...
 
PString GetGroupName () const
 Get the effective group name of the owner of the process, eg "root" etc. More...
 
PBoolean SetGroupName (const PString &groupname, PBoolean permanent=false)
 Set the effective group of the process. More...
 
int GetMaxHandles () const
 Get the maximum file handle value for the process. More...
 
PBoolean SetMaxHandles (int newLimit)
 Set the maximum number of file handles for the process. More...
 
virtual PString GetConfigurationFile ()
 Get the default file to use in PConfig instances. More...
 
void SetConfigurationPath (const PString &path)
 Set the default file or set of directories to search for use in PConfig. More...
 
- Public Member Functions inherited from PThread
bool IsAutoDelete () const
 
int PXBlockOnChildTerminate (int pid, const PTimeInterval &timeout)
 
int PXBlockOnIO (int handle, int type, const PTimeInterval &timeout)
 
void PXAbortBlock () const
 
void PrintOn (ostream &strm) const
 Standard stream print function. More...
 
 PThread (PINDEX stack, AutoDeleteFlag deletion=AutoDeleteThread, Priority priorityLevel=NormalPriority, const PString &threadName=PString::Empty())
 Create a new thread instance. More...
 
 ~PThread ()
 Destroy the thread, this simply calls the Terminate() function with all its restrictions and penalties. More...
 
virtual void Restart ()
 Restart a terminated thread using the same stack priority etc that was current when the thread terminated. More...
 
virtual PBoolean IsTerminated () const
 Determine if the thread has been terminated or ran to completion. More...
 
void WaitForTermination () const
 Block and wait for the thread to terminate. More...
 
PBoolean WaitForTermination (const PTimeInterval &maxWait) const
 Block and wait for the thread to terminate. More...
 
virtual void Suspend (PBoolean susp=true)
 Suspend or resume the thread. More...
 
virtual void Resume ()
 Resume thread execution, this is identical to Suspend(false). More...
 
virtual PBoolean IsSuspended () const
 Determine if the thread is currently suspended. More...
 
virtual void SetPriority (Priority priorityLevel)
 Set the priority of the thread relative to other threads in the current process. More...
 
virtual Priority GetPriority () const
 Get the current priority of the thread in the current process. More...
 
virtual void SetAutoDelete (AutoDeleteFlag deletion=AutoDeleteThread)
 Set the flag indicating thread object is to be automatically deleted when the thread ends. More...
 
void SetNoAutoDelete ()
 Reet the flag indicating thread object is to be automatically deleted when the thread ends. More...
 
virtual PString GetThreadName () const
 Get the name of the thread. More...
 
virtual void SetThreadName (const PString &name)
 Change the name of the thread. More...
 
virtual PThreadIdentifier GetThreadId () const
 Get operating system specific thread identifier for this thread. More...
 
bool GetTimes (Times &times)
 Get the thread execution times. More...
 
- Public Member Functions inherited from PObject
unsigned GetTraceContextIdentifier () const
 Get PTRACE context identifier. More...
 
void SetTraceContextIdentifier (unsigned id)
 
void GetTraceContextIdentifier (PObject &obj)
 
void GetTraceContextIdentifier (PObject *obj)
 
void SetTraceContextIdentifier (const PObject &obj)
 
void SetTraceContextIdentifier (const PObject *obj)
 
virtual ~PObject ()
 
virtual PObjectClone () const
 Create a copy of the class on the heap. More...
 
template<class CLS >
CLS * CloneAs () const
 As for Clone() but converts to specified type. More...
 
virtual PINDEX HashFunction () const
 This function yields a hash value required by the PDictionary class. More...
 
virtual Comparison CompareObjectMemoryDirect (const PObject &obj) const
 Determine the byte wise comparison of two objects. More...
 
bool operator== (const PObject &obj) const
 Compare the two objects. More...
 
bool operator!= (const PObject &obj) const
 Compare the two objects. More...
 
bool operator< (const PObject &obj) const
 Compare the two objects. More...
 
bool operator> (const PObject &obj) const
 Compare the two objects. More...
 
bool operator<= (const PObject &obj) const
 Compare the two objects. More...
 
bool operator>= (const PObject &obj) const
 Compare the two objects. More...
 
virtual const char * GetClass (unsigned ancestor=0) const
 Get the current dynamic type of the object instance. More...
 
PBoolean IsClass (const char *cls) const
 
virtual PBoolean InternalIsDescendant (const char *clsName) const
 Determine if the dynamic type of the current instance is a descendent of the specified class. More...
 
__inline const PObjectPTraceObjectInstance () const
 
virtual void ReadFrom (istream &strm)
 Input the contents of the object from the stream. More...
 

Additional Inherited Members

- Public Types inherited from PProcess
enum  CodeStatus { AlphaCode, BetaCode, ReleaseCode, NumCodeStatuses }
 Release status for the program. More...
 
- Public Types inherited from PThread
enum  Priority {
  LowestPriority, LowPriority, NormalPriority, HighPriority,
  HighestPriority, NumPriorities
}
 Codes for thread priorities. More...
 
enum  AutoDeleteFlag { AutoDeleteThread, NoAutoDeleteThread }
 Codes for thread autodelete flag. More...
 
- Public Types inherited from PObject
enum  Comparison { LessThan = -1, EqualTo = 0, GreaterThan = 1 }
 Result of the comparison operation performed by the Compare() function. More...
 
- Static Public Member Functions inherited from PProcess
static void PostShutdown ()
 
static void PXShowSystemWarning (PINDEX code)
 
static void PXShowSystemWarning (PINDEX code, const PString &str)
 
static PString GetOSClass ()
 Get the class of the operating system the process is running on, eg "unix". More...
 
static PString GetOSName ()
 Get the name of the operating system the process is running on, eg "Linux". More...
 
static PString GetOSHardware ()
 Get the hardware the process is running on, eg "sparc". More...
 
static PString GetOSVersion ()
 Get the version of the operating system the process is running on, eg "2.0.33". More...
 
static bool IsOSVersion (unsigned major, unsigned minor=0, unsigned build=0)
 See if operating system is later than the version specified. More...
 
static PDirectory GetOSConfigDir ()
 Get the configuration directory of the operating system the process is running on, eg "/etc" for Unix, "c:\windows" for Win95 or "c:\winnt\system32\drivers\etc" for NT. More...
 
static PString GetLibVersion ()
 Get the version of the PTLib library the process is running on, eg "2.5beta3". More...
 
static PProcessCurrent ()
 Get the current processes object instance. More...
 
static PBoolean IsInitialised ()
 Determine if the current processes object instance has been initialised. More...
 
static PProcessIdentifier GetCurrentProcessID ()
 Get the platform dependent process identifier for the currentprocess. More...
 
- Protected Types inherited from PProcess
typedef std::map
< PThreadIdentifier, PThread * > 
ThreadMap
 
typedef PList< PThreadThreadList
 
- Protected Member Functions inherited from PProcess
void Construct ()
 
void InternalThreadStarted (PThread *thread)
 
void InternalThreadEnded (PThread *thread)
 
void InternalSetAutoDeleteThread (PThread *thread)
 
void InternalCleanAutoDeleteThreads ()
 
void HouseKeeping ()
 
 PDICTIONARY (PXFdDict, POrdinalKey, PThread)
 
void CommonConstruct ()
 
void CommonDestruct ()
 
virtual void _PXShowSystemWarning (PINDEX code, const PString &str)
 
- Protected Attributes inherited from PProcess
bool m_library
 
int terminationValue
 
PString manufacturer
 
PString productName
 
unsigned majorVersion
 
unsigned minorVersion
 
CodeStatus status
 
unsigned buildNumber
 
PFilePath executableFile
 
PStringArray configurationPaths
 
PArgList arguments
 
int maxHandles
 
PTime programStartTime
 
bool m_shuttingDown
 
PMutex m_threadMutex
 
ThreadMap m_activeThreads
 
ThreadList m_autoDeleteThreads
 
PAtomicBoolean m_keepingHouse
 
PThreadm_houseKeeper
 
PSyncPoint m_signalHouseKeeper
 
PTimer::Listm_timerList
 
PProcessIdentifier m_processID
 
uint32_t m_pxSignals
 
- Friends inherited from PObject

Detailed Description

Class for a process that is a dynamically loaded library.

Constructor & Destructor Documentation

PLibraryProcess::PLibraryProcess ( const char *  manuf = "",
const char *  name = "",
unsigned  majorVersionNum = 1,
unsigned  minorVersionNum = 0,
CodeStatus  statusCode = ReleaseCode,
unsigned  buildNum = 1,
bool  suppressStartup = false 
)
inline

Create a new process instance.

Parameters
manufName of manufacturer
nameName of product
majorVersionNumMajor version number of the product
minorVersionNumMinor version number of the product
statusCodeDevelopment status of the product
buildNumBuild number of the product
suppressStartupDo not execute Startup()

Member Function Documentation

virtual void PLibraryProcess::Main ( )
inlinevirtual

< Dummy Main() as libraries do not have one.

Implements PThread.


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