Experimenting with our new runtime If you remember from Chapter 7, we implemented a join_all method to get our futures running concurrently. In libraries such as Tokio, you’ll find a […]
Read MoreImplementing a proper Reactor – Runtimes, Wakers, and the Reactor-Executor Pattern-3
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 MoreImplementing 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 MoreImplementing 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 MoreA QUICK NOTE ABOUT STATIC LIFETIMES – Runtimes, Wakers, and the Reactor-Executor Pattern-1
When a ‘static lifetime is used as a trait bound as we do here, it doesn’t actually mean that the lifetime of the Future trait we pass in must be […]
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 MoreCreating a proper runtime – Runtimes, Wakers, and the Reactor-Executor Pattern
So, if we visualize the degree of dependency between the different parts of our runtime, our current design could be described this way: Figure 8.5 – Tight coupling between reactor […]
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 MoreChanging the current implementation – Runtimes, Wakers, and the Reactor-Executor Pattern-1
Now that we have an overview of our design and know what to do, we can go on and make the necessary changes to our program, so let’s go through […]
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