SbThreadBarrier Class Reference
[Threads]

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

#include <Inventor/threads/SbThreadBarrier.h>

List of all members.

Public Member Functions

 SbThreadBarrier (int)
virtual ~SbThreadBarrier (void)
int enter ()

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


Constructor & Destructor Documentation

SbThreadBarrier::SbThreadBarrier ( int   ) 

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

virtual SbThreadBarrier::~SbThreadBarrier ( void   )  [virtual]

Destructor.


Member Function Documentation

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:

Open Inventor Toolkit reference manual, generated on 12 Feb 2024
Copyright © Thermo Fisher Scientific All rights reserved.
http://www.openinventor.com/