Open Inventor Release 2023.2.3
 
Loading...
Searching...
No Matches
SbThreadBarrier Class Reference

VSG extension Portable "barrier" class for synchronizing threads. More...

#include <Inventor/threads/SbThreadBarrier.h>

Public Member Functions

 SbThreadBarrier (int)
 Creates a thread barrier that will block until N threads have entered the barrier.
 
virtual ~SbThreadBarrier (void)
 Destructor.
 
int enter ()
 Enter the barrier.
 

Detailed Description

VSG extension Portable "barrier" class for synchronizing threads.

This class provides a portable "barrier" for synchronizing threads. 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.)

A barrier is one type of synchronization construct for threads. It forces a group of threads to "rendezvous" at a particular point in the code. No thread that enters the barrier may leave the barrier until all the threads have entered the barrier.

Specify the number of threads to be synchronized when you create the barrier object. Note it is critical for every thread in the "group" to enter the barrier. There is no other way to release threads already blocked in the barrier.

SEE ALSO

SbThread, SbThreadAutoLock, SbThreadAutoReadLock, SbThreadAutoWriteLock, SbThreadMutex, SbThreadRWMutex

Definition at line 68 of file SbThreadBarrier.h.

Constructor & Destructor Documentation

◆ SbThreadBarrier()

SbThreadBarrier::SbThreadBarrier ( int  )

Creates a thread barrier that will block until N threads have entered the barrier.

◆ ~SbThreadBarrier()

virtual SbThreadBarrier::~SbThreadBarrier ( void  )
virtual

Destructor.

Member Function Documentation

◆ enter()

int SbThreadBarrier::enter ( )

Enter the barrier.

Each thread to be synchronized should call this method. Returns 1 if the caller was the last thread to enter the barrier, 0 otherwise.


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