[Insight-developers] itkTimeStamp Test Failures Mistery

Sean McBride sean at rogue-research.com
Wed Feb 18 11:26:44 EST 2009


On 2/18/09 10:02 AM, Tom Vercauteren said:

>> 1) Yeap, I haven't experimented either with removing the
>>   optimization, to see if this is a "feature" of the
>>   optimized code. Note that since it shows up in multiple
>>   platforms, it would be affected the different optimization
>>   methods that are platform-specific.
>
>That's right but all optimized version use the same pattern:
>  m_ModifiedTime = (unsigned
>long)some_atomic_increment_function(itkTimeStampTime);
>which is why the problem might be in the cast and assign.

I doubt the cast is problematic.  However, looking at this code again,
one thing does strike me:

In the non-optimised case, both the increment and assignment to the
instance variable m_ModifiedTime are within the critical section
(protected by mutex).  In the optimised cases, the increment is atomic,
but the assignment to m_ModifiedTime is not.  That could be a problem.

It would probably be better if m_ModifiedTime itself was passed to the
various atomic increment functions.  The "problem" there is that the
type of m_ModifiedTime would need to be of different type/size on
different platforms.

I could attempt such a patch if you'd like...

-- 
____________________________________________________________
Sean McBride, B. Eng                 sean at rogue-research.com
Rogue Research                        www.rogue-research.com 
Mac Software Developer              Montréal, Québec, Canada




More information about the Insight-developers mailing list