0

I'm not one hundred percent sure what the benefit of "LIFO" (regarding threads) in the IOCP is. I guess the last thread that comes back to the "LIFO queue" can be used with less "overhead" than the others. (Correct me if I'm wrong.)

Let's say we have 10 threads in this "LIFO queue". No.10 is the latest (first to go out if there is completion). No.1 is the last one out and probably requires the most "overhead"?

But before No.1 came back to the queue, it called a "non-blocking function that uses a callback when it's finished". "Callsbacks" usually calls the thread that called them in the first place.

That should mean that even though there are better threads (fresher/more recent) to choose from the "LIFO-queue", no.1 still gets activated when it's time to run the callback function.

So I mostly wonder, how do I make callbacks that work in harmony with the "LIFO-queue"?

Best regards Arre

Arre
  • 125
  • 1
  • 7
  • some example code would get your point across – JohnFilleau May 29 '20 at 12:16
  • Which "IOCP" are you referring to? – molbdnilo May 29 '20 at 12:27
  • @molbdnilo [I/O completion port](https://learn.microsoft.com/en-us/windows/win32/api/ioapiset/nf-ioapiset-createiocompletionport) really this not *c++* but `windows` and `iocp` tag question – RbMm May 29 '20 at 12:29
  • E.g. If one of the threads calls settimer(e.g. 2 min, callbackfunc) then waits by calling GetQueuedCompletionStatus. After 2 min, this same thread probably runs the "callbackfunc"? (what other thread, otherwise?) It may not be the most recent thread in the lifo queue – Arre May 29 '20 at 12:42

0 Answers0