Open fniephaus opened 7 years ago
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
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 ;)
Please don't merge this just yet as there must be an error in the implementation. Using threads causes a segfault :(
Okay, so the segfault is caused by a bug in Pypy's GC. Anyhow, this PR still needs some additional work...
Approach is similar to how
OSThreadLocals
are implemented in Pypy.Comments are welcome!