PM Library classes

class PMThread

? ^ 
    extends PMNonCopyable as public

Thread class.

The PMThread class represents threads of execution within the current program. You can use this class to implement multithreaded applications. Objects of this class give you access to all of the tasking APIs of the operating system. In addition, these objects can serve as the anchor for thread-specific information.

You can construct and destruct objects of this class.

Source:
pm_thread.h:29
Author:
Dmitry A.Steklenev
Version:
$Revision: 1.7 $

Contents

^ 
EntityInherited FromTypeScopeShort Description
PMThreadconstructor public Constructs the thread object.
~PMThreaddestructor public Dealocates thread-related resources.
tidmethod public Obtains the identifier of the thread.
is_alivemethod publicDetermines if this thread is currently active.
startmethod publicThis function causes the thread to start immediately.
joinmethod public Waits the thread.
join_gui_threadmethod public Waits the GUI thread.
suspendmethod public Suspends the thread.
resumemethod public Resumes the thread.
stopmethod public Stops the thread.
prioritymethod public Changes the base priority of the thread.
stack_sizemethod public Returns this thread's stack size.
stack_sizemethod public Sets this thread's stack size.
operator ()operator protected Thread function.

constructor PMThread

? ^  > 
Constructs the thread object.

Use this, the default constructor, to create an object of this class without creating an additional thread of execution. You can subsequently start execution of the thread using PMThread::start.

Source:
pm_thread.h:42
Code:
public PMThread ( )

destructor ~PMThread

? ^  < > 
Dealocates thread-related resources.

When objects of this class are destructed, the thread is not terminated. Deleting a running PMThread will probably result in a program crash. You can join on a thread to make sure that it has finished.

Source:
pm_thread.h:54
Code:
public virtual ~ PMThread ( )

method tid

? ^  < > 
Obtains the identifier of the thread.

Source:
pm_thread.h:63
Returns:
A return value of -1 indicates that the thread is not started.
Code:
public TID tid ( ) const

method is_alive

? ^  < > 
Determines if this thread is currently active.
Source:
pm_thread.h:66
Code:
public BOOL is_alive ( ) const

method start

? ^  < > 
This function causes the thread to start immediately.
Source:
pm_thread.h:68
Code:
public void start ( )

method join

? ^  < > 
Waits the thread.

Places the current thread into a wait state until thread, represented of the PMThread object, has ended.

Source:
pm_thread.h:77
Code:
public void join ( )

method join_gui_thread

? ^  < > 
Waits the GUI thread.

This method then dispatches messages from the queue to the appropriate window or dialog procedure until thread, represented of the PMThread object, has ended.

Note: This method must be called from the same thread where the joined thread has been started.

Source:
pm_thread.h:90
Code:
public void join_gui_thread ( )

method suspend

? ^  < > 
Suspends the thread.

Suspends the thread's execution, which can be undone later with a call to resume. Note that suspend and resume are not recommended mechanisms for thread control. Resources and conditions provide safer services for managing threads.

Source:
pm_thread.h:101
Code:
public void suspend ( )

method resume

? ^  < > 
Resumes the thread.

Resumes a thread's execution after it has been suspended by a call to suspend. Note that suspend and resume are not recommended mechanisms for thread control. Resources and conditions provide safer services for managing threads.

Source:
pm_thread.h:112
Code:
public void resume ( )

method stop

? ^  < > 
Stops the thread.

This function causes the thread to stop immediately, bypassing some normal termination functions. Use it with extreme caution, preferably when the state of the target thread is known.

Source:
pm_thread.h:122
Code:
public void stop ( )

method priority

? ^  < > 
Changes the base priority of the thread.

Source:
pm_thread.h:141
Params:
pclass Priority class of a process. The values of this field are shown in the following list:
PRTYC_NOCHANGE
No change, leave as is.
PRTYC_IDLETIME
Idle-time.
PRTYC_REGULAR
Regular.
PRTYC_TIMECRITICAL
Time-critical.
PRTYC_FOREGROUNDSERVER
Fixed high.

pdelta Change to apply to the current base priority level of the process. This value must range from -31 (PRTYD_MINIMUM) to +31 (PRTYD_MAXIMUM).
Code:
public void priority ( ULONG pclass ,
LONG pdelta )

method stack_size

? ^  < > 
Returns this thread's stack size.

Obtains this thread's stack size in bytes. If it was set when the thread was running, it might not reflect the size of the currently running thread. It only takes affect the next time the thread is started.

Source:
pm_thread.h:152
Code:
public unsigned long stack_size ( ) const

method stack_size

? ^  < > 
Sets this thread's stack size.

Sets this thread's stack size in bytes. If you have already started the thread, this value takes effect only when the thread is stopped and restarted.

Source:
pm_thread.h:162
Code:
public void stack_size ( unsigned long size )

operator ()

? ^  < > 
Thread function.

You must overwrite this method. Note, that the thread function does not take any arguments. Instead, you should define data members and initialise these before you start the thread.

Source:
pm_thread.h:174
Code:
protected virtual void operator () ( ) = 0

Created Fri Aug 3 09:13:16 2012.
This documentation was generated automatically by
ccdoc v08r39 2003/02/27 bin_opt_emx_os2-2.30.
Click here to submit a bug report or feature request for ccdoc.
Click here to return to the top of the page.