static std::string prev;
if (prev != this->GetFileName())
{
#if defined(ITK_USE_VERY_VERBOSE_NIFTI_DEBUGGING)
DumpNiftiHeader(this->GetFileName());
#endif
prev = this->GetFileName();
}
this “prev” useless maybe, damaging Thread Safety
static std::string prev;
if (prev != this->GetFileName())
{
#if defined(ITK_USE_VERY_VERBOSE_NIFTI_DEBUGGING)
DumpNiftiHeader(this->GetFileName());
#endif
prev = this->GetFileName();
}
this “prev” useless maybe, damaging Thread Safety
Is this related to NRRD thread-safety discussion on GitHub PR?
Yes, itkNiftiImageIO’s `static std::string prev;` is not thread-safe.
Since function-level statics are shared by threads, suppressing DumpNiftiHeader in a multi-threaded ITK pipeline requires the introduction of hidden shared state. Not worth it.
It was the proper decision to remove it. Thread safety > small debug optimization is the reason ITK IO must be re-entrant.