Boost logo

Threads-Devel :

Subject: [Threads-devel] reverse_lock exception safety?
From: Fredrik Orderud (forderud_at_[hidden])
Date: 2012-12-21 05:14:52


The implementation of boost::reverse_lock::~reverse_lock calls "lock" on
the mutex retrieved from the provided lock. According to the documentation
[1], "lock" can throw operation_not_permitted,
resource_deadlock_would_occur or device_or_resource_busy exceptions. I
don't see any catching of exceptions inside the destructor, and am
therefore concerned about the exception safety of reverse_lock.

Could someone please explain if reverse_lock is designed to be exception
safe?

If not, then I would guess that it could be made exception safe by moving
the destructor implementation into an explicit "close" method, and assert
on it being called in the destructor.

Thanks in advance,
Fredrik Orderud

[1]
http://www.boost.org/doc/libs/1_52_0/doc/html/thread/synchronization.html#thread.synchronization.mutex_concepts.basic_lockable



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