Open Inventor Release 2024.2.0
 
Loading...
Searching...
No Matches
SbThread Class Reference

VSG extension Portable thread class. More...

#include <Inventor/threads/SbThread.h>

Static Public Member Functions

static SbThreadcreate (void *(threadRoutine)(void *_userData), void *structData)
 Creates a new thread.
 
static void destroy (SbThread *)
 Destroys the specified thread.
 
static void kill (SbThread *thread)
 Signals the specified thread that it should terminate ASAP.
 
static SbBool isStopRequested ()
 Returns true if another thread or process requested termination of this thread.
 
static int increasePriorityLevel (int value=1)
 Valid Priorities values and behavior are OS dependent.
 
static int decreasePriorityLevel (int value=1)
 Decrease thread priority of value unit.
 
static int getPriorityLevel ()
 Return the priority of the current thread.
 
static int setPriorityLevel (int)
 Set the priority of the current thread.
 
static SbThreadId_t getCurrentThreadId ()
 Returns a unique id identifying the current thread.
 
static void setName (const SbThreadId_t &threadId, const char *threadName)
 Assign a debug name to a thread.
 

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

Definition at line 64 of file SbThread.h.

Member Function Documentation

◆ create()

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.

◆ decreasePriorityLevel()

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

Decrease thread priority of value unit.

Returns
0 on success.

◆ destroy()

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.

◆ getCurrentThreadId()

static SbThreadId_t SbThread::getCurrentThreadId ( )
static

Returns a unique id identifying the current thread.

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

◆ getPriorityLevel()

static int SbThread::getPriorityLevel ( )
static

Return the priority of the current thread.

◆ increasePriorityLevel()

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.

◆ isStopRequested()

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.

◆ kill()

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.

◆ setName()

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.

◆ setPriorityLevel()

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: