|
Boost : |
From: Peter Dimov (pdimov_at_[hidden])
Date: 2004-07-07 12:47:37
David Abrahams wrote:
> "Peter Dimov" <pdimov_at_[hidden]> 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() )
{
}
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk