The first thing we do is give HttpGetFuture an identity. It’s the source of events we want to track with our Reactor, so we want it to have the same […]
Read More
Implementing a proper Reactor – Runtimes, Wakers, and the Reactor-Executor Pattern-2
Now that our Reactor is set up, we only have two short functions left. The first one is event_loop, which will hold the logic for our event loop that waits […]
Read More
Implementing a proper Reactor – Runtimes, Wakers, and the Reactor-Executor Pattern-1
The final part of our example is the Reactor. Our Reactor will: When we’re done with this step, we should have everything we need for our runtime, so let’s get […]
Read More
A QUICK NOTE ABOUT STATIC LIFETIMES – Runtimes, Wakers, and the Reactor-Executor Pattern-2
block_on will be the entry point to our Executor. Often, you will pass in one top-level future first, and when the top-level future progresses, it will spawn new top-level futures […]
Read MoreImplementing a proper Executor – Runtimes, Wakers, and the Reactor-Executor Pattern-2
ExecutorCore holds all the state for our Executor: ExecutorCore derives the Default trait since there is no special initial state we need here, and it keeps the code short and […]
Read MoreCreating a Waker – Runtimes, Wakers, and the Reactor-Executor Pattern
So, we need to find a different way for our executor to sleep and get woken up that doesn’t rely directly on Poll. It turns out that this is quite […]
Read MoreImproving our runtime design by adding a Reactor and a Waker – Runtimes, Wakers, and the Reactor-Executor Pattern
In this step, we’ll make the following changes: Tip You’ll find this example in the ch08/b-reactor-executor folder. If you follow along by writing the examples from the book, I suggest […]
Read MoreChanging the current implementation – Runtimes, Wakers, and the Reactor-Executor Pattern-2
The next function is the block_on function. I’ll go through it step by step: If the future returns NotReady, we write out a message letting us know that at this […]
Read MoreDesign – Runtimes, Wakers, and the Reactor-Executor Pattern
Before we go any further, let’s visualize how our system is currently working if we consider it with two futures created by coroutine/wait and two calls to Http::get. The loop […]
Read MoreReactors and executors – Runtimes, Wakers, and the Reactor-Executor Pattern
Dividing the runtime into two distinct parts makes a lot of sense when we take a look at how Rust models asynchronous tasks. If you read the documentation for Future […]
Read More