Boost logo

Threads-Devel :

Subject: [Threads-devel] boost::unique_lock<boost::mutex>::timed_lock --> win32 versus pthreads
From: Geoff Shapiro (gshapiro_at_[hidden])
Date: 2010-05-12 02:39:33

Hi Anthony,

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.

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...

Geoff Shapiro
FLIR Systems, Inc.

Threads-Devel list run by bdawes at, david.abrahams at, gregod at, cpdaniel at, john at