Skip to content

Implement ThreadLocals#867

Open
fniephaus wants to merge 9 commits intotopazproject:masterfrom
fniephaus:threadlocals
Open

Implement ThreadLocals#867
fniephaus wants to merge 9 commits intotopazproject:masterfrom
fniephaus:threadlocals

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