Commit 95aea46c authored by David E. DeMarle's avatar David E. DeMarle

Merge branch 'fix-smp-examples-atomics-new' into release

Change-Id: I385e9b1295eced295b8d2839259f902fd2714f9b
parents 8ef02395 485d1744
#include "vtkSMPMinMaxTree.h"
#include "vtkConfigure.h"
#include "vtkObjectFactory.h"
#include "vtkIdList.h"
#include "vtkGenericCell.h"
......@@ -9,6 +10,49 @@
#include "vtkSMPThreadLocal.h"
#include "vtkSMPThreadLocalObject.h"
#if defined(__APPLE__)
# include <libkern/OSAtomic.h>
# define VTK_APPLE_ATOMIC
#endif
#if defined(_WIN32) && !defined(__MINGW32__)
# include "vtkWindows.h"
# define VTK_WINDOWS_ATOMIC
#endif
#if !defined(VTK_APPLE_ATOMIC) && !defined(VTK_WINDOWS_ATOMIC) &&\
!defined(VTK_HAVE_SYNC_BUILTINS)
# error "No built in support for atomic increment found."
#endif
#if defined(VTK_USE_64BIT_IDS) && !(VTK_SIZEOF_VOID_P == 8)
# error "No support for atomic increment on 64-bits vtkIdType."
#endif
inline vtkIdType AtomicIncrementAndFetch(vtkIdType &var)
{
#if defined(VTK_HAVE_SYNC_BUILTINS)
return __sync_add_and_fetch(&var, 1);
#elif defined(VTK_APPLE_ATOMIC)
# ifdef VTK_USE_64BIT_IDS
return OSAtomicIncrement64Barrier(&var);
# else
return OSAtomicIncrement32Barrier(&var);
# endif
#elif defined(VTK_WINDOWS_ATOMIC)
# ifdef VTK_USE_64BIT_IDS
return InterlockedIncrement64(&var);
# else
return InterlockedIncrement32(&var);
# endif
#endif
}
namespace
{
......@@ -78,7 +122,7 @@ namespace
while ( index )
{
index = ( index - 1 ) / this->BF;
if ( __sync_add_and_fetch(&(this->Locks[index]), 1) != this->BF )
if ( AtomicIncrementAndFetch(this->Locks[index]) != this->BF )
break;
for ( vtkIdType i = index * this->BF + 1; i < ( index + 1 ) * this->BF && i < this->Max; ++i )
{
......
......@@ -8,7 +8,7 @@
class vtkTimerLog;
class VTKCOMMONEXECUTIONMODEL_EXPORT vtkStreamedCompositeDataPipeline :
class VTK_EXPORT vtkStreamedCompositeDataPipeline :
public vtkCompositeDataPipeline
{
//BTX
......
......@@ -4,7 +4,7 @@
#include "vtkCommonExecutionModelModule.h" // For export macro
#include "vtkStreamedCompositeDataPipeline.h"
class VTKCOMMONEXECUTIONMODEL_EXPORT vtkStreamedCompositeSources :
class VTK_EXPORT vtkStreamedCompositeSources :
public vtkStreamedCompositeDataPipeline
{
vtkStreamedCompositeSources(const vtkStreamedCompositeSources&);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment