|
Boost : |
From: Larry Evans (jcampbell3_at_[hidden])
Date: 2002-01-20 10:54:06
Peter Dimov wrote:
[snip]
> > #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.
>
Yes. Thanks. I should have asked earlier about atomic.h. My compiler
didn't include it; so, I had to add an -idirafter flag.
Anyway, the output is now what I'd expected:
TEST2:shared_ptr<SuperType> a_up(DerivedType*)
+subj_base:c_count=1:m_id=2
+subjA:this=0x80533a8
+subjB:this=0x80533b0
+subjAB:this=0x80533a8
a_up.use_count(b4 reset)=1
~subjB:this=0x80533b0
subjB::operator b4 delete:0x80533b0
make: *** [run] Segmentation fault
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk