Boost logo

Boost Users :

Subject: Re: [Boost-users] [Thread][win32, msvc] Mutexes
From: Frank Mori Hess (fmhess_at_[hidden])
Date: 2008-09-28 13:16:35


On Sunday 28 September 2008 04:29, Anthony Williams wrote:
> No. boost::mutex is a lightweight mutex. It has slightly different
> performance characteristics than CRITICAL_SECTION: it is intended to
> be "better" than CRITICAL_SECTION.
>
> > If not so, what's the reason for boost::detail::lightweight_mutex to
> > exist ?
>
> I think it's a historic artifact from versions of boost.thread prior
> to 1.35.0 when boost::mutex required linking to the thread library,
> which allowed mutexes to be used in header-only boost libraries.

I didn't realize boost::mutex was header-only now. I recently put a
modified version of detail::lightweight_mutex (conforming to the
Boost.Thread Lockable concept) into thread_safe_signals svn. I wanted
header-only, plus it compiles to no-op when thread support is disabled/not
present. Unfortunately, I also had to add a little unique_lock fill-in
because boost/thread/locks.hpp still requires linking, due to the
definition of the lock_error exception.




Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net