Boost logo

Boost :

From: Peter Dimov (pdimov_at_[hidden])
Date: 2002-05-29 11:00:42


From: "Jerry Napoli" <jnapoli_at_[hidden]>
> Hi,
>
> I apologize in advance if I'm sending this question to the wrong list,
> but I already tried the user's list and got no response.

I see two responses on boost-users, one from Darin and another from Lars.

> I'm using boost version 1.27.0 on an x86 linux platform and have just
> upgraded my kernel to 2.4.18. After the upgrade, boost::shared_ptr
> fails to compile because functions such as "atomic_inc_and_test",
> "atomic_dec_and_test", etc.. which were previously defined in "atomic.h"
> are no longer defined there. I can get around the problem by using an
> older "atomic.h" or by using pthreads, but I was wondering why those
> functions were removed from the header, or what direction development
> will take to use atomicity without going through a thread library like
> pthreads.

The dependency on asm/atomic.h in 1.27.0 was a mistake. User programs should
not depend on kernel headers; they aren't guaranteed to be available, or to
compile in C++ mode.

1.28.0 uses pthreads by default; this is safe but less efficient. You can
force asm/atomic.h to be used via #define BOOST_USE_ASM_ATOMIC_H, but this
is not recommended.

The recent atomic_count_gcc and lightweight_mutex_gcc patches (that aren't
part of the 1.28.0 release but are available from the CVS) use the atomic
operations in libstdc++, GCC 3.x's C++ standard library.

And of course you should keep in mind that in a program that doesn't use
threads, #define BOOST_DISABLE_THREADS will eliminate the thread safety
overhead in shared_ptr. Unfortunately, there is no way (I know of) to
autodetect whether the "real" pthreads library is being used (on this
platform.)


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