diff -bur boost_1_32_0/boost/detail/lwm_win32.hpp boost_1_32_0.patched/boost/detail/lwm_win32.hpp --- boost_1_32_0/boost/detail/lwm_win32.hpp 2004-07-26 02:31:59.000000000 +0200 +++ boost_1_32_0.patched/boost/detail/lwm_win32.hpp 2005-02-21 12:58:18.640625000 +0100 @@ -37,11 +37,15 @@ // Intel 6.0 on Win64 version, posted by Tim Fenders to [boost-users] +#if defined (__INTEL_COMPILER) extern "C" long_type __cdecl _InterlockedExchange(long volatile *, long); +#elif defined (_MSC_VER) +extern "C" long __cdecl _InterlockedExchange(long volatile *, long); +#endif #pragma intrinsic(_InterlockedExchange) -inline long InterlockedExchange(long volatile* lp, long l) +inline long InterlockedExchangeBoost(long volatile* lp, long l) { return _InterlockedExchange(lp, l); } @@ -87,7 +91,11 @@ explicit scoped_lock(lightweight_mutex & m): m_(m) { +#if defined (_WIN64) + while( InterlockedExchangeBoost(&m_.l_, 1) ) +#else while( InterlockedExchange(&m_.l_, 1) ) +#endif { // Note: changed to Sleep(1) from Sleep(0). // According to MSDN, Sleep(0) will never yield @@ -100,8 +108,11 @@ ~scoped_lock() { +#if defined (_WIN64) + InterlockedExchangeBoost(&m_.l_, 0); +#else InterlockedExchange(&m_.l_, 0); - +#endif // Note: adding a yield here will make // the spinlock more fair and will increase the overall // performance of some applications substantially in