Skip to content
This repository has been archived by the owner on Jan 5, 2024. It is now read-only.

scope() should be async #3

Open
thomas001 opened this issue Apr 21, 2022 · 1 comment
Open

scope() should be async #3

thomas001 opened this issue Apr 21, 2022 · 1 comment

Comments

@thomas001
Copy link

When scope() returns all remaining scoped futures have to complete. From reading the code this is achieved via synchronous blocking and tokio::task::block_in_place. The latter only works on a corresponding multi threaded runtime.

Please evaluate whether it wouldn't be simpler to declare scope() itself async and run the future completion step asynchronously.

@jaboatman
Copy link
Owner

Such an implementation is unsafe as you can drop the scope (and borrowed data) before the spawned futures complete.

If you want that, consider using async_scoped instead. In general, consider using instead of this crate.

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

No branches or pull requests

2 participants