Boost logo

Boost :

From: Jesse Jones (jesjones_at_[hidden])
Date: 2001-03-15 20:25:12


>From: <williamkempf_at_[hidden]>
>> > I'm far from a threading expert, but I did take a quick look at the
>> code
>> > and the docs. It looks like a good start, but I do have some
>> quibbles:
>> >
>> > 1) You should throw an exception if CreateSemaphore returns nil or
>> > INVALID_HANDLE_VALUE.
>>
>> Other's have pointed out the lack of error handling. I did this
>> intentionally in the draft, but it's something that needs addressed
>> before submission.
>>
>> > 2) CloseHandle can also fail, but you don't want to throw from a
>> dtor so an
>> > assert might be good.
>>
>> When used properly it's next to impossible for CloseHandle to fail,
>> and the library insulates the user from misusing CloseHandle. So I
>> see no need to use an assert here.
>
>This seems like exactly the right place for an assert, as opposed
>to an exception. It isn't supposed to ever happen, so the user
>needn't worry it. But if it does happen something is wrong with the
>library or the underlying thread system, so you should assert that.
>
>Leaving an error return code unchecked is almost never the right
>thing, IMHO.

This is exactly my thinking.

  -- Jesse


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk