Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Better docs on multi-threaded executor #317

Open
junderw opened this issue Aug 18, 2024 · 4 comments
Open

Better docs on multi-threaded executor #317

junderw opened this issue Aug 18, 2024 · 4 comments
Assignees

Comments

@junderw
Copy link
Contributor

junderw commented Aug 18, 2024

In the same vein as #63 (which was based on v0.1 iirc)

Currently, the docs don't make it clear that "If you have an fn main() {} and you want to start a multithreaded executor and get it running and polling I/O, this is how you do it"

I was trying to find a decisive answer for this person that is upgrading from v0.1 to v2, but I couldn't really find something that makes the same guarantees that smol::run used to (the docs says it used to start a multithreaded and thread local executor.)

https://www.reddit.com/r/learnrust/comments/1eulhti/problem_with_smol_update/

A doc improvement might help in this situation.

If anyone just wants to answer the OP that would help too.

Thanks.

@notgull notgull self-assigned this Aug 18, 2024
@notgull
Copy link
Member

notgull commented Aug 22, 2024

I would accept a PR improving the docs here.

@junderw
Copy link
Contributor Author

junderw commented Aug 22, 2024

I'm not familiar with smol, but if you can give a 2 sentence blurb of how to do it I can make a PR.

@notgull
Copy link
Member

notgull commented Aug 22, 2024

Create an Executor and call run() in block_on() to run the executor, then use spawn() to spawn tasks.

Alternatively, don't worry about it and just use smol-macros to scaffold up to a threadpooled executor immediately.

@junderw
Copy link
Contributor Author

junderw commented Aug 22, 2024

I'll peek at the expanded output of smol-macros and use it to write some example code for the docs... but I'll be sure to mention the smol-macros crate.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants