mattn / mruby-thread

48 stars 31 forks source link

Thread#join only work with finxum/float value. #14

Closed bggd closed 10 years ago

bggd commented 10 years ago

This code was segfault in vs2012(with pthreads-for-win32) and mingw-w64.

v = "foo"
th = Thread.new(v) do |x|
  puts x
  x
end

a = th.join
puts a
mattn commented 10 years ago

I figured out.

Previous commit is wrong.

https://github.com/mattn/mruby-thread/blob/master/src/mrb_thread.c#L215

It should be mrb instead of context->mrb. Because context in the thread is already terminated. I'll revert previous commit.