Boost logo

Boost :

From: Peter Dimov (pdimov_at_[hidden])
Date: 2002-05-30 06:20:18


From: "Ralf W. Grosse-Kunstleve" <rwgk_at_[hidden]>
> --- Peter Dimov <pdimov_at_[hidden]> wrote:
> > From: "Ralf W. Grosse-Kunstleve" <rwgk_at_[hidden]>
> > > > | Lars Gullik Bjønnes' recent contribution to shared_ptr has a
> > dependency on
> > > > | sched_yield (as do most optimized lightweight_mutex
implementations.)
> > >
> > > Is it possible to disable the thread facilities with a #define?
> >
> > Yes, #define BOOST_DISABLE_THREADS.
>
> Great, this works for us. Thanks!
>
> Just a remark: to me it seems odd that thread support is on by default. To
me
> it would make more sense if I had to request thread support if I want it,
e.g.
> via #define BOOST_ENABLE_THREADS.

Thread support is in "autodetect" mode by default. Many compilers #define a
predefined macro (_MT, _REENTRANT, etc) in multithreaded mode; Boost.Config
recognizes these macros and defines BOOST_HAS_THREADS automatically.
BOOST_DISABLE_THREADS overrides the autodetection.

Unfortunately, g++ doesn't have a separate multithreaded mode. On Linux, its
library will even supply stub pthread_ and sched_ functions automatically,
if you don't link to -lpthreads / -lrt (an annoying habit.)


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