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

Comments

Projects
None yet
1 participant
@njsmith
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

This comment has been minimized.

Member

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 from missing feature: task-local storage to missing feature: task- and run-local storage Mar 1, 2017

@njsmith

This comment has been minimized.

Member

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.

njsmith added a commit to njsmith/trio that referenced this issue May 28, 2017

njsmith added a commit to njsmith/trio that referenced this issue May 28, 2017

@njsmith njsmith closed this in #179 May 29, 2017

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