Boost logo

Boost :

From: williamkempf_at_[hidden]
Date: 2001-10-24 16:05:59


--- In boost_at_y..., Bill Seymour <bsey_at_p...> wrote:
> williamkempf_at_h... wrote:
> >
> > --- In boost_at_y..., "Anson Tsao" <ansont_at_m...> wrote:
> >
> > > 2) WaitForSingleObject return values that are not WAIT_OBJECT_0
are
> > > asserted in a number of places. They are runtime conditions
that can
> > > return WAIT_ABANDONED, should probably throw an exception
instead.
> >
> > Possibly. AFAIK, however, the MS platform is the only one that
has
> > the concept of abandoned mutexes, so I hesitate to add an
exception
> > type for this platform specific case. I'll give it much greater
> > thought now that it's raised by someone else.
> >
>
> I think the question is whether the error return values
> should cause assertions or throw exceptions; and Anson
> notes that they represent run-time, not compile-time,
> conditions.

I don't follow this. Both assertions and exceptions detect at
runtime.

> As for WAIT_ABANDONED, it means that the thread or process
> that had the mutex locked has halted for some reason, so
> it's reasonable to consider the mutex no longer locked.

That depends on your definition of "reasonable". IMO the entire
program has reached a state that may very well not be recoverable
when you wind up with an abandoned mutex. It's a serious programming
error for this to occur, frankly. And with scoped locks it's very
unlikely to ever occur (the one "hole" is if a user calls the Win32
API TerminateThread, but that's a whole different issue).

> I've always treated WAIT_OBJECT_0 and WAIT_ABANDONED as
> equivalent; and Bill's finding that other platforms don't
> even have the concept of abandoned mutexes would seem to
> support that view.

Not really. I believe the other "platforms" don't have abandoned
mutexes solely because they don't provide much usability. This is a
programming error that simply should not occur in a well formed
program.

Bill Kempf


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