-
I create a Runtime in tokio::runtime - Rust
-
I spawn a numbed rof tasks using the Runtime
-
Is there a way to say: block current OS thread unril all async tasks in Runtime finishes ?
This constraint gives it a value of about 584,942,417,355 years in practice,
This is good enough for my needs; but is this the 'right' way to do it? This feels bit hacky.
Actually, this doesn't work -- shutdown_timeout adds Duration::MAX, causing overflow.
The shutdown methods probably don't do what you want - all of the tasks are cancelled and all they are waiting for is their destructors (and spawn_blocking
tasks, which cannot be cancelled).
Tokio doesn't have a general way to actually wait for all tasks, unfortunately.
1 Like