Boost logo

Boost :

From: Peter Dimov (pdimov_at_[hidden])
Date: 2003-04-01 10:09:25


Neal D. Becker wrote:
> Here is some more on this problem. Perhaps someone on this list has
> some ideas where to look? Defining BOOST_NO_THREAD (or whatever it
> was) will "fix" the problem, but I suspect it's not the correct fix.
> The code will link OK dynamically, but not statically. That's
> strange.

I'm not sure how you determine the correctness of the BOOST_DISABLE_THREADS
fix.

Defining BOOST_DISABLE_THREADS causes Boost.Config to not define
BOOST_HAS_THREADS, even if the platform is detected as multithreaded.

boost::shared_ptr uses BOOST_HAS_THREADS to determine whether to synchronize
reference count updates, see for example boost/detail/shared_count.hpp:118:

    void add_ref()
    {
#if defined(BOOST_HAS_THREADS)
        mutex_type::scoped_lock lock(mtx_);
#endif
        if(use_count_ == 0 && weak_count_ != 0)
boost::throw_exception(boost::bad_weak_ptr());
        ++use_count_;
        ++weak_count_;
    }

On your platform mutex_type is defined in boost/detail/lwm_pthreads.hpp. It
doesn't use #pragma weak. I wasn't able to find #pragma weak, how it is
used, and the proper procedure in making a component "weakly pthread aware"
documented anywhere. If someone knows what to do, a patch would be
appreciated.


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