LIFO ordering of return from GetQueuedCompletionStatus

53 Views Asked by At

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:

  1. T1 associates handle H1 with the IOCP followed by T2 associating handle H2 with the same IOCP.
  2. T1 calls GetQueuedCompletionStatus and is blocked.
  3. T2 calls GetQueuedCompletionStatues and is blocked.
  4. The I/O call operation 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?

0

There are 0 best solutions below