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

missing feature: task- and run-local storage #2

Closed
njsmith opened this issue Jan 22, 2017 · 2 comments
Closed

missing feature: task- and run-local storage #2

njsmith opened this issue Jan 22, 2017 · 2 comments

Comments

@njsmith
Copy link
Member

njsmith commented Jan 22, 2017

Similar to what I implemented in curio

It'd be nice if run_in_worker_thread preserved the task-local context.

@njsmith
Copy link
Member Author

njsmith commented Mar 1, 2017

While we're at it we should probably have "run local" storage too: a place to stash stuff that's local to this run, and which automatically disappears when the run ends. Example: the getaddrinfo semaphore (#10).

Technically this is possible to fake already by using thread-local storage + a system task for notification of the run shutdown, but there's no reason to make this that difficult.

@njsmith njsmith changed the title missing feature: task-local storage missing feature: task- and run-local storage Mar 1, 2017
@njsmith
Copy link
Member Author

njsmith commented May 26, 2017

Then again, it's also possible to fake run-local storage by just setting a task-local storage key early on (like in your main task) and then letting it be inherited by all child tasks... though this does waste some memory if you have lots of tasks.

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

No branches or pull requests

1 participant