Boost logo

Boost :

From: John Torjo (john.lists_at_[hidden])
Date: 2004-09-22 08:56:19

Hi Peter,

I think there is a bug in your Interlocked* implementation of shared_ptr

In atomic_read you have:
inline long atomic_read(long volatile const & value)
     return value;

I don't believe this is thread-safe.
In order to make sure you're receiving the latest value, I assume you
could do something like:

inline long atomic_read(long volatile & value)
     const int IMPOSSIBLE_VALUE = -100;
     return InterlockedCompareExchange(&value, IMPOSSIBLE_VALUE,

Am I missing something?


John Torjo
-- john_at_[hidden]
Contributing editor, C/C++ Users Journal
-- "Win32 GUI Generics" -- generics & GUI do mix, after all
-- v1.4 - save_dlg - true binding of your data to UI controls!
    + easily add validation rules (win32gui/examples/smart_dlg)

Boost list run by bdawes at, gregod at, cpdaniel at, john at