re: Rust futures: an uneducated, short and hopefully not boring tutorial - Part 3 - The reactor VIEW POST

FULL DISCUSSION
 

Hi

many thanks for that tutorial, really interesting! I just got one question:

You state the reactor parks our future in case we return

Ok(Async::NotReady)

But here, you seem to notify the reactor to unpark before we return Ok(Async::NotReady):

println!("not ready yet --> {:?}", self);
futures::task::current().notify();
Ok(Async::NotReady)

So the reactor gets a notification to unpark something that's not yet been parked, doesn't it? ;-)

 

Ah yes it's true.
It's an horrible way of simulating the external unpark command :)

Ideally this command should be issued by another "entity" (for example the OS in case of async IO).

code of conduct - report abuse