Boost logo

Boost :

Subject: Re: [boost] n2427 atomic implementation?
From: vicente.botet (vicente.botet_at_[hidden])
Date: 2008-11-19 10:19:41


----- Original Message -----
From: "Anthony Williams" <anthony.ajw_at_[hidden]>
To: <boost_at_[hidden]>
Sent: Wednesday, November 19, 2008 12:14 AM
Subject: Re: [boost] n2427 atomic implementation?

>
> "vicente.botet" <vicente.botet_at_[hidden]> writes:
>
>> Can the N2427 - C++ Atomic Types and Operations be implemented
>> without the help of the compiler?
>
> No.
>
> They don't need to be intrinsics --- if you can write inline assembler
> (or separately-compiled assembler for that matter) then you can write
> the operations themselves directly. You might even be able to use
> simple C++ (e.g. just plain assignment for load or store).
>
> The reason you need compiler support is preventing inappropriate
> optimizations: atomic operations can't be optimized out, and generally
> must not be reordered before or after any other operations. This means
> that even non-atomic stores performed before an atomic store have to
> be complete, and can't be cached in a register (for example). Also,
> loads that occur after an atomic operation cannot be hoisted before
> the atomic op.
>
> On some compilers, just using inline assembler is enough. On others,
> calling an external function is enough. MSVC provides
> _ReadWriteBarrier() to provide the compiler ordering. Other compilers
> need other flags.
>
>> Do some one have a partial implementation?
>
> I have a full implementation for MSVC 2008 as part of my C++0x thread
> library, currently in beta: http://www.stdthread.co.uk

Hi,

Sorry but I don't have MSVC 2008, to do the installation. So I have just take a look at the doc and header files.

BTW, I was not aware that your future proposal was currently adopted by the C++ Standard. Is it?

"
just::thread Headers
The just::thread library provides the following Standard C++0x headers:
<chrono>
<condition_variable>
<cstdatomic>
<future>
<mutex>
<ratio>
<stdatomic.h>
<system_error>
<thread>
"

How your 'just::' implementation performs respect to Boost.Thread, Boost.Chrono and Boost.Exception?

Thanks,


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk