SbThread Class Reference
[Threads]

VSG extension Portable thread class. More...

#include <Inventor/threads/SbThread.h>

List of all members.

Static Public Member Functions

static SbThreadcreate (void *(threadRoutine)(void *_userData), void *structData)
static void destroy (SbThread *)
static void kill (SbThread *thread)
static SbBool isStopRequested ()
static int increasePriorityLevel (int value=1)
static int decreasePriorityLevel (int value=1)
static int getPriorityLevel ()
static int setPriorityLevel (int)
static SbThreadId_t getCurrentThreadId ()
static void setName (const SbThreadId_t &threadId, const char *threadName)

Detailed Description

VSG extension Portable thread class.

This class provides a portable representation of a thread. It is implemented using the pthreads API on UNIX/Linux and the Win32 API on Microsoft Windows.

It is not necessary to use this class in order to use multiple threads with Open Inventor. It is provided only as a convenience. However, note that you should use pthreads on UNIX/Linux and Win32 on Windows to be certain of compatibility with Open Inventor.

SEE ALSO

SbThreadAutoLock, SbThreadAutoReadLock, SbThreadAutoWriteLock, SbThreadBarrier, SbThreadMutex, SbThreadRWMutex

See related examples:

GetDataBox_MultiThread


Member Function Documentation

static SbThread* SbThread::create ( void *  threadRoutine)(void *_userData,
void *  structData 
) [static]

Creates a new thread.

The thread will immediately begin executing the specified function, which will be passed the userData pointer. Typically userData will point to a struct or class containing information the thread needs to initialize.

static int SbThread::decreasePriorityLevel ( int  value = 1  )  [static]

Decrease thread priority of value unit.

Returns:
0 on success.
static void SbThread::destroy ( SbThread  )  [static]

Destroys the specified thread.

Note that, in general, threads are automatically destroyed by the operating system when the application (process) exits.

static SbThreadId_t SbThread::getCurrentThreadId (  )  [static]

Returns a unique id identifying the current thread.

Actually returns the native (pthreads or Win32) thread id.

static int SbThread::getPriorityLevel (  )  [static]

Return the priority of the current thread.

static int SbThread::increasePriorityLevel ( int  value = 1  )  [static]

Valid Priorities values and behavior are OS dependent.

on WINDOWS platforms priority is in the range [ THREAD_PRIORITY_LOWEST .. THREAD_PRIORITY_HIGHEST ] on UNIX it depends on the current scheduling policy (which is SCHED_OTHER by default) see sched_get_priority_min/sched_get_priority_max for details in manpage of the given UNIX System. Increase thread priority of value unit.

Returns:
0 on success.
static SbBool SbThread::isStopRequested (  )  [static]

Returns true if another thread or process requested termination of this thread.

It is particularly useful for stopping an infinitely looping worker thread.

static void SbThread::kill ( SbThread thread  )  [static]

Signals the specified thread that it should terminate ASAP.

This is a non-blocking call. Then user should call destroy to wait for real thread termination.

static void SbThread::setName ( const SbThreadId_t &  threadId,
const char *  threadName 
) [static]

Assign a debug name to a thread.

Note: Only some platforms/compilers have the capability to use/show thread names.

Note: Currently only implemented on Windows platforms and only in the Debug build.

static int SbThread::setPriorityLevel ( int   )  [static]

Set the priority of the current thread.

Returns:
0 on success.

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

Open Inventor Toolkit reference manual, generated on 15 Mar 2023
Copyright © Thermo Fisher Scientific All rights reserved.
http://www.openinventor.com/