Info
This post is auto-generated from RSS feed The Rust Programming Language Forum - Latest topics. Source: Smol-rs: Multi-threaded + executor from parameter?
Hi
I started contributing to Arti a while ago to get more fluent in Rust. Currently I'm working on a MR to implement smol
as a runtime: smol: Implement smol in tor-rtcompat (!2986) ยท Merge requests ยท The Tor Project / Core / Arti ยท GitLab
The MR is close to being finished but I received the following comment requesting some changes.
1) create_runtime()
needs to make a multi-threaded executor. Currently it creates a single threaded executor.
I made this commit: smol: Implement smol in tor-rtcompat (!2986) ยท Merge requests ยท The Tor Project / Core / Arti ยท GitLab
Is this the correct approach? smol
also provides a crate easy-parallel
but I am not sure if that crate is better then my current implementation.
2) Add functions to create a smol runtime from an existing smol executor. For example if the user is using smol_macros::main!
, they will want to use their existing smol executor (Arc<smol::Executor<'static>>
) with arti.
How would I do this? I found this doc regarding the macro but would like some extra pointers in the correct direction. Would I just provide a method like create_runtime_from(ex: Executor)
which returns SmolRuntime {executor: ex}
?
1 post - 1 participant
๐ท๏ธ rust_feed