[quoted text, click to view] William DePalo wrote:
> Sean Kelly <kensai@pacbell.net> wrote in message
> news:uLKunk#zDHA.2180@TK2MSFTNGP12.phx.gbl...
>
>>When both waiting on an event and a simple unnamed mutex, I'm wondering
>>when WaitForSingleObject might return WAIT_FAILED. These are both
>>execution paths I'd very much like to avoid exceptional behavior but I
>>haven't found much documentation on the specifics. Can anyone offer
>
> advice?
>
> Well, suppose you pass an invalid handle to the function? I'd expect that
> you will get a WAIT_FAILED status and then INVALID_HANDLE in the call to
> GetLastError(). I don't think there is any way you can avoid checking the
> status of the code _somewhere_.
This is in an object and ensapsulation ensures that the parameters
passed will always be valid. Basically, I'm trying to avoid the
possibility that an exception may be thrown when acquiring a lock on a
mutex. Critical section operations are guranteed to succeed for this
reason. More info: it's an unnamed mutex without any security
restrictions. Basically, just an object that creates the mutex on
construction, locks/unlocks the mutex when requested, and destroys the
mutex on destruction. What I'm looking for is someone with enough
knowledge of the inner workings of the call that they could tell be what
conditions might cause a WAIT_FAILED in this instance. I'm hoping that
if I can satisfy enough preconditions before calling the function I can
be guranteed that the function will never fail in this way.
Sean