Regina Calculation Engine
Public Member Functions | Static Public Member Functions
regina::NThread Class Reference

Provides very basic thread handling. More...

#include <utilities/nthread.h>

Inheritance diagram for regina::NThread:
regina::NFacePairing

List of all members.

Public Member Functions

virtual ~NThread ()
 Destroys this thread.
bool start (void *args=0, bool deleteAfterwards=false)
 Starts a new thread that performs the run() routine.
virtual void * run (void *args)=0
 The routine to run in the new thread when start(void*) is called.

Static Public Member Functions

static bool start (void *(*routine)(void *), void *args, NThreadID *id)
 Starts a new thread that performs the given routine.
static void yield ()
 Causes the currently running thread to voluntarily relinquish the processor.

Detailed Description

Provides very basic thread handling.

Each subclass of NThread represents a specific task that new threads should perform.

A subclass should override run() so that it performs whatever task is required of each new thread. Then start() may be called whenever a new thread is required.

Warning:
Qt and KDE have only limited support for multithreading. When working with an existing packet tree in a new thread, the only modification that you may make is to insert new packets. Modifications of any other type (such as changing, renaming, deleting or reordering existing packets) may lead to a crash within Qt or Xlib when running the GUI. Of course, a new thread may create, modify and delete its own temporary packet trees as it chooses (and it may in fact insert them into a pre-existing packet tree once all modifications are completed).
Python:
Not present.

Constructor & Destructor Documentation

regina::NThread::~NThread ( ) [inline, virtual]

Destroys this thread.


Member Function Documentation

virtual void* regina::NThread::run ( void *  args) [pure virtual]

The routine to run in the new thread when start(void*) is called.

Parameters:
argsthe argument passed to start(void*).
Returns:
the return value is currently ignored.

Implemented in regina::NFacePairing.

bool regina::NThread::start ( void *  args = 0,
bool  deleteAfterwards = false 
)

Starts a new thread that performs the run() routine.

The return value of run() is currently ignored.

Parameters:
argsthe arguments to pass to run() when it is started.
deleteAfterwardstrue if this NThread object should be deleted once run() has finished.
Returns:
true if and only if the new thread was successfully started.
static bool regina::NThread::start ( void *(*)(void *)  routine,
void *  args,
NThreadID id 
) [static]

Starts a new thread that performs the given routine.

The return value of the given routine is currently ignored.

Parameters:
routinethe routine to run in the new thread.
argsthe arguments to pass to routine when it is started.
ida location in which the ID of the new thread will be placed, or 0 if the new thread ID is not required. If non-zero, this parameter must point to an already extisting NThreadID that may contain any value.
Returns:
true if and only if the new thread was successfully started.
void regina::NThread::yield ( ) [inline, static]

Causes the currently running thread to voluntarily relinquish the processor.

Another thread of equal or higher priority will be given a turn instead.


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

Copyright © 1999-2011, The Regina development team
This software is released under the GNU General Public License.
For further information, or to submit a bug or other problem, please contact Ben Burton (bab@debian.org).