|
Boost : |
Subject: Re: [boost] [spinlock] Spin on volatile read, NUMA fairness?
From: Niall Douglas (s_sourceforge_at_[hidden])
Date: 2014-12-04 08:25:09
On 4 Dec 2014 at 3:39, Peter Dimov wrote:
> and that it's better to do this:
>
> // atomic_bool f_;
>
> do
> {
> while( f_.load( std::memory_order_relaxed ) )
> {
> /* maybe yield */
> }
> }
> while( f_.exchange( true, std::memory_order_acquire ) );
>
> instead.
I just tested this form instead, and on VS2013 dual core x86 I saw a
45% performance increase. Very nice. Thank you.
Niall
-- ned Productions Limited Consulting http://www.nedproductions.biz/ http://ie.linkedin.com/in/nialldouglas/
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk