Comment

Comment by insanitybit

> As I understand it's not possible in Rust async model,

You can block, you're just going to block all other futures that are executed on that same underlying thread. But all sorts of things block, for loops block.

This is the same as Java, I believe. Akka also has special actors called IO Workers that are designed for blocking work - Rust has the same thing with `spawn_blocking`, which will place the work onto a dedicated threadpool.

> So in reality you don't interrupt or clean up anything in Rust when a timeout happens

You don't interrupt, you are yielded to. It's cooperative.

> I wonder what happens with resources if there were allocated.

When a Future is dropped its state is dropped as well, so they are all freed.

parent insanitybit 3 years ago

Discussion

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton