Reactor, handling I/O event notifications
Question
How can a waker efficiently knows when its data is ready?
Answer
“efficiently” means no loop. In other words, a waker should be notified when its data is ready. Such effectiveness is often achieved by using the notification mechanisms provided by the operating systems.
Case
For futures which represent results of I/O operations, the “I/O event notification mechanisms” provided by the operating systems can be used to notify the wakers.
In this case, the wakers interact with some specific code that waits for the I/O event notifications. This specific code is often called “reactor”.
Diagram: A waker driven by a reactor.