Boost logo

Threads-Devel :

From: Anthony Williams (anthony_at_[hidden])
Date: 2008-04-08 11:38:07

Quoting Frank Mori Hess <frank.hess_at_[hidden]>:

> The backwards-compatibility typedef of scoped_try_lock to unique_lock in the
> mutex classes doesn't look right. The old scoped_try_lock constructor with a
> single argument:
> try_mutex::scoped_try_lock(mutex)
> is the equivalent of
> unique_lock<try_mutex>(mutex, try_to_lock_t())
> but old code will get mapped to the blocking single argument constructor of
> unique_lock.

Yes, someone else spotted that today as well. I didn't notice when I
made the typedefs, and the tests need extending to check that
behaviour. It's unfortunate that nobody noticed before 1.35.0 went out
the door. Ho hom.

> I think it would be better to either not have the typedef at all or
> to provide
> a member class that really is backward compatible. There is also the smaller
> issue that the old constructors that take a bool for the second argument are
> not supported, although it seems they could be mapped onto the new
> constructors trivially. Maybe have some scoped_lock wrapper classes that
> publicly derive from unique_lock but have backward compatible constructors?

Yes. I've been thinking about this since this morning. Both of these
options seem acceptable to me. I'll have a look at writing the wrappers.


Anthony Williams            | Just Software Solutions Ltd
Custom Software Development |
Registered in England, Company Number 5478976.
Registered Office: 15 Carrallack Mews, St Just, Cornwall, TR19 7UL

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