Subject: [boost] boost.atomic library works on Linux but not on Windows -- please help
From: Anqing Xu (anqingxu_at_[hidden])
Date: 2010-07-07 17:16:09
In search of a std:atomic<T> implementation, I decided
to give boost.atomic library a try. My initial investigation found it worked
fine under linux. However it does not
work on Windows.
Here is a little test program to demonstrate:
int* pInt1 = pool.allocate();
*pInt1 = 1;
int* pInt2 = pool.allocate();
*pInt2 = 2;
int* pInt3 = pool.allocate();
*pInt3 = 3;
int* pInt4 = pool.allocate();
int* pInt5 = pool.allocate();
int* pInt6 = pool.allocate();
The test uses boost.lockfree library, which you can download
If you set a break point, say in fallback.hpp, you will see
that on Windows it falls back to spinlock.
Can somebody please suggest how to fix this?
I suspect the issue has something to do with intptr_t type.
I looked into the code but quickly started to have
headache. Atomic library uses template
metaprogramming and is not easy to understand.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk