ITK  5.0.0
Insight Segmentation and Registration Toolkit
Public Types | Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes | List of all members
itk::Barrier Class Reference

#include <itkBarrier.h>

+ Inheritance diagram for itk::Barrier:
+ Collaboration diagram for itk::Barrier:

Detailed Description

Standard barrier class implementation for synchronizing the execution of threads.

A barrier class is used to synchronize threaded execution by allowing threads to block until each has reached a desired state. As each thread enters the barrier it blocks. When all threads have entered the barrier, all released and continue to execute.

A thread enters the barrier by calling Barrier::Wait() on the barrier class. To set up a barrier class, call Barrier::Initialize(unsigned int), specifying the number of waiting threads that will trigger a release of the barrier as the argument.

NOTE: This class is only compatible with PlatformMultiThreader!

NOTE: This class is deprecated since ITK 5.0!

Definition at line 49 of file itkBarrier.h.

Public Types

using ConstPointer = SmartPointer< const Self >
 
using Pointer = SmartPointer< Self >
 
using Self = Barrier
 
using Superclass = LightObject
 
- Public Types inherited from itk::LightObject
using ConstPointer = SmartPointer< const Self >
 
using Pointer = SmartPointer< Self >
 
using Self = LightObject
 

Public Member Functions

virtual ::itk::LightObject::Pointer CreateAnother () const
 
virtual const char * GetNameOfClass () const
 
void Initialize (unsigned int)
 
void Wait ()
 
- Public Member Functions inherited from itk::LightObject
virtual void Delete ()
 
virtual int GetReferenceCount () const
 
 itkCloneMacro (Self)
 
void Print (std::ostream &os, Indent indent=0) const
 
virtual void Register () const
 
virtual void SetReferenceCount (int)
 
virtual void UnRegister () const noexcept
 

Static Public Member Functions

static Pointer New ()
 
- Static Public Member Functions inherited from itk::LightObject
static void BreakOnError ()
 
static Pointer New ()
 

Private Member Functions

 Barrier ()
 
 ~Barrier () override
 

Private Attributes

std::condition_variable m_ConditionVariable
 
unsigned int m_Generation {0}
 
std::mutex m_Mutex
 
unsigned int m_NumberArrived {0}
 
unsigned int m_NumberExpected {0}
 

Additional Inherited Members

- Protected Member Functions inherited from itk::LightObject
virtual LightObject::Pointer InternalClone () const
 
 LightObject ()
 
virtual void PrintHeader (std::ostream &os, Indent indent) const
 
virtual void PrintSelf (std::ostream &os, Indent indent) const
 
virtual void PrintTrailer (std::ostream &os, Indent indent) const
 
virtual ~LightObject ()
 
- Protected Attributes inherited from itk::LightObject
std::atomic< int > m_ReferenceCount
 

Member Typedef Documentation

Definition at line 58 of file itkBarrier.h.

Definition at line 57 of file itkBarrier.h.

Standard class type aliases.

Definition at line 55 of file itkBarrier.h.

Definition at line 56 of file itkBarrier.h.

Constructor & Destructor Documentation

itk::Barrier::Barrier ( )
private
itk::Barrier::~Barrier ( )
overrideprivate

Member Function Documentation

virtual::itk::LightObject::Pointer itk::Barrier::CreateAnother ( ) const
virtual

Create an object from an instance, potentially deferring to a factory. This method allows you to create an instance of an object that is exactly the same type as the referring object. This is useful in cases where an object has been cast back to a base class.

Reimplemented from itk::LightObject.

virtual const char* itk::Barrier::GetNameOfClass ( ) const
virtual

Run-time type information (and related methods).

Reimplemented from itk::LightObject.

void itk::Barrier::Initialize ( unsigned  int)

Creates a new system variable used to implement the barrier. The argument to this method is the number of threads that must Wait() on the barrier before it is cleared.

static Pointer itk::Barrier::New ( )
static

Method for creation through the object factory.

void itk::Barrier::Wait ( )

A thread calling this method waits until m_NumberOfThreads have called Wait() on the barrier. When the final expected thread calls Wait(), all threads are released.

Member Data Documentation

std::condition_variable itk::Barrier::m_ConditionVariable
private

Definition at line 83 of file itkBarrier.h.

unsigned int itk::Barrier::m_Generation {0}
private

Definition at line 82 of file itkBarrier.h.

std::mutex itk::Barrier::m_Mutex
private

Definition at line 84 of file itkBarrier.h.

unsigned int itk::Barrier::m_NumberArrived {0}
private

Definition at line 80 of file itkBarrier.h.

unsigned int itk::Barrier::m_NumberExpected {0}
private

Definition at line 81 of file itkBarrier.h.


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