diff options
author | eregon <eregon@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2018-09-25 10:41:16 +0000 |
---|---|---|
committer | eregon <eregon@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2018-09-25 10:41:16 +0000 |
commit | e87fb88be844f0fae736768846954b6f6f7dc7c3 (patch) | |
tree | cbe2ab069e40b5b7f3217ce95b793426b303a305 /spec/ruby/optional/capi/thread_spec.rb | |
parent | e59bf54b3a88d0465cca021afae7dc05b6db57a7 (diff) |
Update to ruby/spec@241f9e7
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64831 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'spec/ruby/optional/capi/thread_spec.rb')
-rw-r--r-- | spec/ruby/optional/capi/thread_spec.rb | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/spec/ruby/optional/capi/thread_spec.rb b/spec/ruby/optional/capi/thread_spec.rb index f60e9ba065..52070198fd 100644 --- a/spec/ruby/optional/capi/thread_spec.rb +++ b/spec/ruby/optional/capi/thread_spec.rb @@ -123,5 +123,27 @@ describe "C-API Thread function" do # And we got a proper value thr.value.should be_true end + + it "runs a C function with the global lock unlocked amd unlocks IO with the generic RUBY_UBF_IO" do + thr = Thread.new do + @t.rb_thread_call_without_gvl_with_ubf_io + end + + # Wait until it's blocking... + Thread.pass while thr.status and thr.status != "sleep" + + # The thread status is set to sleep by rb_thread_call_without_gvl(), + # but the thread might not be in the blocking read(2) yet, so wait a bit. + sleep 0.1 + + # Wake it up, causing the unblock function to be run. + thr.wakeup + + # Make sure it stopped + thr.join(1).should_not be_nil + + # And we got a proper value + thr.value.should be_true + end end end |