Boost logo

Threads-Devel :

Subject: Re: [Threads-devel] boost::unique_lock<boost::mutex>::timed_lock --> win32 versus pthreads
From: Anthony Williams (anthony_at_[hidden])
Date: 2010-05-12 03:12:24


On 12/05/10 07:39, Geoff Shapiro wrote:
> The threading library documentation would lead me to believe that a
> unique_lock<mutex> should not model the TimedLockable concept because the
> supplied mutex type, boost::mutex, does not model the TimedLockable concept.

Correct.

> Therefore, it should not be valid to call timed_lock on such a lock object. But,
> I notice that on win32, this is not the case. Because the win32 implementation's
> boost::mutex inherits from basic_timed_mutex publicly, code is able to call
> timed_lock on the unique_lock<mutex> and be successfully compiled and used. The
> pthreads implementation correctly disallows the timed_lock interface
> availability on unique_lock<mutex>.
>
>
> Intentional? Oversight? I'm curious...

It's an oversight. It should be private inheritance and using directives.

Well spotted, thanks.

Anthony

-- 
Author of C++ Concurrency in Action     http://www.stdthread.co.uk/book/
just::thread C++0x thread library             http://www.stdthread.co.uk
Just Software Solutions Ltd       http://www.justsoftwaresolutions.co.uk
15 Carrallack Mews, St Just, Cornwall, TR19 7UL, UK. Company No. 5478976

Threads-Devel list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk