Boost logo

Boost :

Subject: [boost] [shared_ptr][thread] spinlock initialization
From: Yi Ding (yi.s.ding_at_[hidden])
Date: 2012-09-26 18:17:41


I started using the spinlock in boost/smart_ptr/detail/spinlock.hpp
and discovered that it needs to be manually initialized, even for the
spinlock_sync version, which became a nasty bug when it manifested
itself. This seems a bit out of sync with the rest of the mutexes in
boost::thread.

Now, I'm guessing that the fact that the spinlock is in boost::detail
means that it's not really for outside consumption (newbie boost user
here), but is there something in the works that will be?

In the meantime, would it be possible to automatically initialize the
spinlock (trivial in the case of spinlock_sync) or are there
architectural issues with that? Otherwise, could we add a comment
that says "in order to use these spinlocks you must initialize with
BOOST_DETAIL_SPINLOCK_INIT" or "move along, these aren't the spinlocks
you're looking for."


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