Main Page   Groups   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Concepts

itkBarrier.h

Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Insight Segmentation & Registration Toolkit
00004   Module:    $RCSfile: itkBarrier.h,v $
00005   Language:  C++
00006   Date:      $Date: 2007-01-25 23:18:04 $
00007   Version:   $Revision: 1.10 $
00008 
00009   Copyright (c) Insight Software Consortium. All rights reserved.
00010   See ITKCopyright.txt or http://www.itk.org/HTML/Copyright.htm for details.
00011 
00012      This software is distributed WITHOUT ANY WARRANTY; without even 
00013      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 
00014      PURPOSE.  See the above copyright notices for more information.
00015 
00016 =========================================================================*/
00017 #ifndef __itkBarrier_h
00018 #define __itkBarrier_h
00019 
00020 #include "itkLightObject.h"
00021 #include "itkConditionVariable.h"
00022 #include "itkMutexLock.h"
00023 
00024 #ifdef ITK_USE_FETCHOP_BARRIERS
00025 extern "C" {
00026 #include <sys/pmo.h>
00027 #include <fetchop.h>
00028 }
00029 #endif
00030 
00031 #ifdef ITK_USE_SPROC
00032 extern "C" {
00033 #include <ulocks.h>
00034 }
00035 #endif
00036 
00037 namespace itk {
00038 
00061 class ITKCommon_EXPORT Barrier : public LightObject
00062 {
00063 public:
00064 
00066   typedef Barrier                   Self;
00067   typedef LightObject               Superclass;
00068   typedef SmartPointer<Self>        Pointer;
00069   typedef SmartPointer<const Self>  ConstPointer;
00070 
00072   itkNewMacro(Self);
00073 
00075   itkTypeMacro(Barrier, Object);
00076 
00080   void Initialize(unsigned int);
00081 
00085   void Wait();
00086 
00087 private:
00088   Barrier();
00089   ~Barrier();
00090 
00091 #if defined ITK_USE_FETCHOP_BARRIERS
00092   static bool               m_ReservoirInitialized;
00093   static atomic_reservoir_t m_Reservoir;
00094   static int                m_MaxBarriers;
00095   atomic_var_t *            m_Pvar;
00096 
00097   char pad1[128];              // Attempt to put
00098   volatile int m_FetchopFlag;  // m_Fetchop on its
00099   char pad2[128];              // own cache line.
00100 
00101 #elif defined ITK_USE_SPROC
00102   barrier_t *m_Barrier;
00103 
00104 #else
00105   ConditionVariable::Pointer m_ConditionVariable;
00106   unsigned int               m_NumberArrived;
00107   SimpleMutexLock            m_Mutex;
00108 
00109 #endif
00110 
00111   unsigned int m_NumberExpected;
00112 };
00113 
00114 } // end namespace itk
00115 
00116 #endif
00117 

Generated at Mon Jul 12 2010 17:45:53 for ITK by doxygen 1.7.1 written by Dimitri van Heesch, © 1997-2000