|
Boost Users : |
Subject: Re: [Boost-users] Q: N00b spinlock
From: Gottlob Frege (gottlobfrege_at_[hidden])
Date: 2010-01-21 13:19:13
>
> nevertheless, i would be happy to see spinlocks and reader-writer
> spinlocks as part of boost.thread. they could easily be implemented via
> boost.atomic.
>
can we implement it with test-and-test-and-set instead of just test-and-set?
while (locked || XCHG(&locked, 1))
yield();
ie only do the memory barrier check if there is likelyhood of it succeeding.
Tony
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net