Scenario 4: Call a Function When Asynchronous I/O Requests Complete

In Chapter 10, I talked about how to perform asynchronous I/O operations efficiently using the Windows I/O completion port. In that chapter, I explained how you could create a thread pool where the threads wait on the I/O completion port. Fortunately, the thread pool being discussed throughout this chapter manages the creation and destruction of threads for you, and these threads internally wait on an I/O completion port. However, when you open a file or device, you must associate the file/device with the thread pool’s I/O completion port. Then you must tell the thread pool which function of yours to invoke when the asynchronous I/O operations you make of the file/device complete. ...

Get Windows® via C/C++, Fifth Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.