Windows IOCP documentation states this with regard to GetQueuedCompletionStatus
:
Threads that block their execution on an I/O completion port are released in last-in-first-out (LIFO) order, and the next completion packet is pulled from the I/O completion port's FIFO queue for that thread.
Consider a scenario with threads T1 and T2:
- T1 associates handle H1 with the IOCP followed by T2 associating handle H2 with the same IOCP.
- T1 calls
GetQueuedCompletionStatus
and is blocked. - T2 calls
GetQueuedCompletionStatues
and is blocked. - The I/O
calloperation on H1 completes.
Now, given the above statement that the threads "are released in last-in-first-out (LIFO) order", will T1 remain in a wait state till T2 is released to satisfy LIFO ordering?