Skip to content

Build task_local! data from a Future #1187

@Ekleog

Description

@Ekleog

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?)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions