Skip to content

Build task_local! data from a Future #1187

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

Closed
Ekleog opened this issue Aug 8, 2018 · 3 comments
Closed

Build task_local! data from a Future #1187

Ekleog opened this issue Aug 8, 2018 · 3 comments

Comments

@Ekleog
Copy link

Ekleog commented Aug 8, 2018

Conversation moved to rustasync/team#7

I am currently designing a crate. In this crate, I have a lazy_static! HashMap, that I'm filling with one piece of data per task, in the task_local! constructor.

As a consequence, I have to handle locking to this HashMap. Which would seem to be handled cleanly only by constructing the actual piece of data from a Future, so that the executor loop doesn't have to stop waiting for the RwLock when spawning a task.

What do you think about this idea? (also, is there maybe some other way I don't know of to associate each task with a serializable ID and additional metadata, and my problem is void?)

@tikue
Copy link
Contributor

tikue commented Sep 20, 2018

Should conversation converge on rustasync/team#7?

@Ekleog
Copy link
Author

Ekleog commented Sep 20, 2018

Good point, leaving this open until rustasync/team#7 is solved so that people who search for it find it, plan to close once that's solved :)

@cramertj
Copy link
Member

rustasync/team#7 has been closed

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

No branches or pull requests

3 participants