
7 Jul
2004
7 Jul
'04
5:47 p.m.
David Abrahams wrote:
"Peter Dimov" <pdimov@mmltd.net> writes:
This is certainly possible, but I don't see what the additional complexity buys us.
TryLock l( m, false );
if( l.try_lock() ) { }
looks acceptable to me.
TryLock l( m, non_blocking );
if( l.locked() ) { }
doesn't seem much of an improvement.
It does to me. I like names that say what they mean; false could easily be misinterpreted.
'false' is existing practice in this case, which is why I used it in the example. But it's a distraction; to level the playing field compare: TryLock l( m, unlocked ); if( l.try_lock() ) { } with: TryLock l( m, non_blocking ); if( l.locked() ) { }