From: Scott Gifford on
Hello,

I'm investingting a situation that's causing my app to hang. It only
occurs very rarely, and the last time it happend, my application logs
helped me narrow it down to a few lines. It's basically in the
Microsoft-provided GPS intermediate driver sample code, in the Close
method of the Gps class. It takes a lock, then calls:

1. GpsCloseDevice on the open GPS device
2. EventModify to set a local event indicating that any background
readers should stop
3. CloseHandle on the two events passed to GpsOpenDevice
4. CloseHandle on the handle signalled in (2)

I was under the impression that all of these would return immediately
with either success or failure . Is there some circumstance I'm not
aware of that could cause them to hang for a long time (like an hour)?
Or cause them to throw an exception rather than return an error code?

There is similar code that makes several calls to CreateEvent and then
a call to GpsOpenDevice. It similarly assumes all of these will be
fast calls, and so does them while holding a lock, and that they will
return an error code rather than throw an exception.

Any ideas are appreciated,

----Scott.