
19 Oct
2009
19 Oct
'09
4:03 p.m.
Hi Vladimir, On Oct 14, 2009, at 7:13 AM, Sakharuk, Vladimir wrote:
Steven, Thanks! If I can not use detail folder is there other ways I can use atomic based spinlock?
It's not in Boost, but the Intel Threading Building Blocks has an atomic class that you could use to implement an atomic spinlock. Perhaps something like this might work? // atomic's have no constructors but you can reply on their being zero initialized tbb::atomic<int> ai; ... while(1) { if (1 == ai.compare_and_swap(1, 0)) { // ... --ai; // atomic decrement break; } } -- Noel