|
Boost : |
From: Peter Dimov (pdimov_at_[hidden])
Date: 2002-01-20 10:23:24
From: "Larry Evans" <jcampbell3_at_[hidden]>
> > I am using Peter's
http://groups.yahoo.com/group/boost/files/smart_ptr_3.zip.
> > I've tried using gdb to trace and see what's happening, but it's
skipping some
> > lines of code (I guess because of optimizing). Anyway, here's the
output:
>
> Probably only the implementors would be interested in the details below.
>
> Update: used -fno-default-inline oncompiler and traced the problem to
> a work-around to no atomic.h with my compiler. I simply created my own
> atomic.h as follows:
>
> #define ATOMIC_INIT(X) X
> typedef long atomic_t;
> static void atomic_inc(atomic_t*a_val){++*a_val;}
> static long atomic_dec_and_test(atomic_t*a_val){return --*a_val;}
> static long atomic_read(atomic_t const*a_val){return *a_val;}
According to
http://kernelnewbies.org/documents/kdoc/kernel-api/r287.html
atomic_dec_and_test should return --*a_val == 0;
BTW I thought that atomic.h was required to be present on Linux? It's in
/usr/include/asm/atomic.h on my system.
BTW2 You can #define BOOST_DISABLE_THREADS to make atomic_count be a simple
long.
-- Peter Dimov Multi Media Ltd.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk