[Libevent-users] GetQueuedCompletionStatus return values question/problem

Toby Douglass toby.douglass at summerblue.net
Wed Nov 1 08:16:57 EST 2006


This is for those of you who've done some IO completion port work.

According to my reading of the docs, GetQueuedCompletionStatus has four 
return status';

---

1. return value != 0
    - all went well, we've just returned from a successful dequeuing

2. return value != 0 and lpOverlapped == NULL
    - all handles associated with the IO completion object have been 
closed and the IO completion object itself has been closed (time to quit)

3. return value == 0 and lpOverlapped != NULL
    - GetQueuedCompletionStatus() was okay, but we dequeued a *failed* 
IO operation (note that lpNumberOfBytes is not set in this case)

4. return value == ERROR_SUCCESS and lpOverlapped != NULL and 
*lpNumberOfBytes == 0
    - the handle we've come back on is actually a socket, and the remote 
host has closed

---

Now, the problem is this: ERROR_SUCCESS is #defined as zero!

In other words, I don't think it's possible to differentiate between 
case 3 and 4, because in case 3, *lpNumberOfBytes might be 0 just by chance.



More information about the Libevent-users mailing list