summaryrefslogtreecommitdiff
path: root/spec/ruby/optional
diff options
context:
space:
mode:
authorSamuel Williams <samuel.williams@oriontransfer.co.nz>2023-05-24 22:45:34 +0900
committerGitHub <noreply@github.com>2023-05-24 22:45:34 +0900
commit6d976eb5348098a346d82065621e37925acae8b8 (patch)
tree683b659bc406be332691f94ea6d41906fa0578c6 /spec/ruby/optional
parent85b4cd7cf80d4029f65fde3e574b31f4b0e538ea (diff)
Fix "runs a C function with the global lock unlocked and unlocks IO with the generic RUBY_UBF_IO" on Windows. (#7848)
* Enable borked spec. * Ensure win32 wrappers are visible and used. * Reorganise `read`/`write`/`pipe` in `thread_spec.c`.
Notes
Notes: Merged-By: ioquatix <samuel@codeotaku.com>
Diffstat (limited to 'spec/ruby/optional')
-rw-r--r--spec/ruby/optional/capi/ext/thread_spec.c5
-rw-r--r--spec/ruby/optional/capi/thread_spec.rb29
2 files changed, 17 insertions, 17 deletions
diff --git a/spec/ruby/optional/capi/ext/thread_spec.c b/spec/ruby/optional/capi/ext/thread_spec.c
index be812d796f..6307e5cc99 100644
--- a/spec/ruby/optional/capi/ext/thread_spec.c
+++ b/spec/ruby/optional/capi/ext/thread_spec.c
@@ -8,7 +8,10 @@
#include <unistd.h>
#endif
#if defined(_WIN32)
-#define pipe(p) rb_w32_pipe(p)
+#include "ruby/win32.h"
+#define read rb_w32_read
+#define write rb_w32_write
+#define pipe rb_w32_pipe
#endif
#ifndef _WIN32
diff --git a/spec/ruby/optional/capi/thread_spec.rb b/spec/ruby/optional/capi/thread_spec.rb
index 953664f291..af641f0564 100644
--- a/spec/ruby/optional/capi/thread_spec.rb
+++ b/spec/ruby/optional/capi/thread_spec.rb
@@ -165,26 +165,23 @@ describe "C-API Thread function" do
end
end
- # This test is disabled on Windows: https://bugs.ruby-lang.org/issues/16265
- platform_is_not :mingw, :windows do
- it "runs a C function with the global lock unlocked and unlocks IO with the generic RUBY_UBF_IO" do
- thr = Thread.new do
- @t.rb_thread_call_without_gvl_with_ubf_io
- end
+ it "runs a C function with the global lock unlocked and 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 until thr.stop?
+ # Wait until it's blocking...
+ Thread.pass until thr.stop?
- # 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
+ # 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
+ # Wake it up, causing the unblock function to be run.
+ thr.wakeup
- # Make sure it stopped and we got a proper value
- thr.value.should be_true
- end
+ # Make sure it stopped and we got a proper value
+ thr.value.should be_true
end
end
end