Boost logo

Boost Users :

Subject: Re: [Boost-users] [Thread][win32, msvc] Mutexes
From: Anthony Williams (anthony.ajw_at_[hidden])
Date: 2008-09-28 04:29:56


"Alexander Gutenev" <gutenev_at_[hidden]> writes:

> I consider changing from win32 CRITICAL_SECTIONs to Boost.Thread mutexes.
>
> boost::mutex isn't CRITICAL_SECTION, but boost::detail::lightweight_mutex
> is. Does this mean that boost::mutex is heavy-weight ?

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'll leave it to Peter to comment on whether he thinks it's still
required and why.

Anthony

-- 
Anthony Williams            | Just Software Solutions Ltd
Custom Software Development | http://www.justsoftwaresolutions.co.uk
Registered in England, Company Number 5478976.
Registered Office: 15 Carrallack Mews, St Just, Cornwall, TR19 7UL

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