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

Implement ThreadLocals #867

Open
wants to merge 9 commits into
base: master
Choose a base branch
from

Conversation

fniephaus
Copy link
Contributor

Approach is similar to how OSThreadLocals are implemented in Pypy.

Comments are welcome!

Approach is similar to how OSThreadLocals are implemented in Pypy
@eregon
Copy link

eregon commented Mar 17, 2017

Just a note in case it's useful: Thread#[] and #[]= in Ruby can also access "thread-local" variables of other Thread instances (and even set them):

t = Thread.new { Thread.current[:foo] = :bar }.join
t[:foo] # => :bar

@fniephaus
Copy link
Contributor Author

Interesting, @eregon. I think this should be possible with this approach.
However, this PR does not implement the Ruby API yet. That's the next thing to implement.
But, @timfel offered to help with that once he is free ;)

@fniephaus
Copy link
Contributor Author

Please don't merge this just yet as there must be an error in the implementation. Using threads causes a segfault :(

@fniephaus
Copy link
Contributor Author

Okay, so the segfault is caused by a bug in Pypy's GC.
Anyhow, this PR still needs some additional work...

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

Successfully merging this pull request may close these issues.

2 participants