Commit 9f3ab9bf authored by Ben Boeckel's avatar Ben Boeckel Committed by Kitware Robot

Merge topic 'timestamp-static-notice'

f90a80d9 vtkTimeStamp: add a notice for future linker-ghost chasing souls
5481d80b vtkTimeStamp: remove old comment
64dbb110 typo: fix name of "Schwarz" counter references
Acked-by: Kitware Robot's avatarKitware Robot <kwrobot@kitware.com>
Acked-by: Utkarsh Ayachit's avatarUtkarsh Ayachit <utkarsh.ayachit@kitware.com>
Acked-by: default avatarRobert Maynard <robert.maynard@kitware.com>
Merge-request: !6036
parents 60066e85 f90a80d9
......@@ -281,7 +281,7 @@ private:
void operator=(const vtkObjectFactory&) = delete;
};
// Implementation detail for Schwartz counter idiom.
// Implementation detail for Schwarz counter idiom.
class VTKCOMMONCORE_EXPORT vtkObjectFactoryRegistryCleanup
{
public:
......
......@@ -17,9 +17,6 @@
#include "vtkObjectFactory.h"
#include "vtkWindows.h"
// We use the Schwarz Counter idiom to make sure that GlobalTimeStamp
// is initialized before any other class uses it.
#include "vtkAtomicTypes.h"
//-------------------------------------------------------------------------
......@@ -32,6 +29,27 @@ vtkTimeStamp* vtkTimeStamp::New()
//-------------------------------------------------------------------------
void vtkTimeStamp::Modified()
{
// Here because of a static destruction error? You're not the first. After
// discussion of the tradeoffs, the cost of adding a Schwarz counter on this
// static to ensure it gets destructed is unlikely to be worth the cost over
// just leaking it.
//
// Solutions and their tradeoffs:
//
// - Schwarz counter: each VTK class now has a static initializer function
// that increments and integer. This cannot be inlined or optimized away.
// Adds latency to ParaView startup.
// - Separate library for this static. This adds another library to VTK
// which are already legion. It could not be folded into a kit because
// that would bring you back to the same problem you have today.
// - Leak a heap allocation for it. It's 24 bytes, leaked exactly once, and
// is easily suppressed in Valgrind.
//
// The last solution has been decided to have the smallest downside of these.
//
// static const vtkAtomicUIntXX* GlobalTimeStamp = new vtkAtomicUIntXX(0);
//
// Good luck!
#if defined(VTK_USE_64BIT_TIMESTAMPS) || VTK_SIZEOF_VOID_P == 8
static vtkAtomicUInt64 GlobalTimeStamp(0);
#else
......
......@@ -131,7 +131,7 @@ struct Serialization<vtkDataSet*>
};
}
// Implementation detail for Schwartz counter idiom.
// Implementation detail for Schwarz counter idiom.
class VTKPARALLELDIY_EXPORT vtkDIYUtilitiesCleanup
{
public:
......
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