20 Feb
2002
20 Feb
'02
6:18 p.m.
--- In Boost-Users@y...,
I was wondering about this line in boost::detail::thread::scoped_try_lock:
if(m_locked) throw lock_error();
Since it is known that the lock attempt might fail and we do not want to block until the lock becomes available, is it not better to simply return false in the above case instead of throwing lock_error?
If you call this while m_locked is true you've violated the contract. So a return of false isn't appropriate, but I expect that it may become an assertion instead. Bill Kempf