Ideas on how to model structured concurrency in Rust, as well as some thoughts on tasks, errors, and panics... 1/29
-
Show this thread
-
But first, what is structured concurrency anyway? Here are some links worth checking out. 2/29 https://en.wikipedia.org/wiki/Structured_concurrency … https://kotlinlang.org/docs/reference/coroutines/basics.html#structured-concurrency … https://medium.com/@elizarov/structured-concurrency-722d765aa952 …https://trio.discourse.group/t/structured-concurrency-kickoff/55 …
1 reply 2 retweets 6 likesShow this thread -
Put succinctly, structured concurrency is all about robustly spawning/awaiting tasks and propagating errors/panics from child tasks into parent tasks, more or less. 3/29
1 reply 2 retweets 5 likesShow this thread -
Tokio kicked off a research effort on structured concurrency. Some great ideas were proposed, but we're still pretty much at square one and don't have readily available solutions. 4/29https://github.com/tokio-rs/tokio/issues/1879 …
1 reply 2 retweets 5 likesShow this thread -
Right now, all our "hello world" TCP echo examples are suffering from glaring problems. Take for example these from tokio and async-std. 5/29 https://github.com/tokio-rs/tokio/blob/57ba37c97854d32e691ea68006c8d69d58c79b23/examples/echo.rs … https://github.com/async-rs/async-std/blob/2dbebe54ede4d2c0a18380f51e785d5306022ac5/examples/tcp-echo.rs …
1 reply 0 retweets 3 likesShow this thread -
Tokio's example panics on errors with expect(), which is a shame because it would be much nicer to use the ? operator. Panics inside tasks are then silently "swallowed" by tokio and ignored, i.e. they don't propagate anywhere. 6/29pic.twitter.com/g9r1la9nfR
2 replies 1 retweet 6 likesShow this thread -
Replying to @stjepang
https://docs.rs/tokio/0.2.13/tokio/task/index.html#spawning … “Again, like std::thread's JoinHandle type, if the spawned task panics, awaiting its JoinHandle will return a JoinError`” I haven’t used tokio for a while, but it seems like panics are handled ?
1 reply 0 retweets 5 likes
You're correct, I missed that part! Thanks for pointing it out!
-
-
Thanks. Twitter will use this to make your timeline better. UndoUndo
-
Loading seems to be taking a while.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.