Boost logo

Boost :

From: Greg Colvin (gcolvin_at_[hidden])
Date: 2001-03-16 12:07:02

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
> 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.

Boost list run by bdawes at, gregod at, cpdaniel at, john at