summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIvo Anjo <ivo.anjo@datadoghq.com>2021-02-22 17:54:10 +0000
committerIvo Anjo <ivo.anjo@datadoghq.com>2021-02-22 17:54:10 +0000
commit7099d9594667297baa8fd3a23a5f610649b4a7fc (patch)
tree39389ee40a83588340753c9f792f8cf01c3b562a
parentdf411d08f6e444402bc4950b8622cf6b03ea0c96 (diff)
downloadffi-7099d9594667297baa8fd3a23a5f610649b4a7fc.tar.gz
Fix callback thread spec failing on Windows
This was probably failing due to thread naming being a racy operation; by keeping a reference to the thread and checking it after the call finishes, this will hopefully be enough for the name to become available.
-rw-r--r--spec/ffi/async_callback_spec.rb6
1 files changed, 3 insertions, 3 deletions
diff --git a/spec/ffi/async_callback_spec.rb b/spec/ffi/async_callback_spec.rb
index 02338e5..aab54e0 100644
--- a/spec/ffi/async_callback_spec.rb
+++ b/spec/ffi/async_callback_spec.rb
@@ -39,10 +39,10 @@ describe "async callback" do
skip "not yet supported on TruffleRuby" if RUBY_ENGINE == "truffleruby"
skip "not yet supported on JRuby" if RUBY_ENGINE == "jruby"
- thread_name = nil
+ callback_runner_thread = nil
- LibTest.testAsyncCallback(proc { thread_name = Thread.current.name }, 0)
+ LibTest.testAsyncCallback(proc { callback_runner_thread = Thread.current }, 0)
- expect(thread_name).to eq("FFI::Function Callback Runner")
+ expect(callback_runner_thread.name).to eq("FFI::Function Callback Runner")
end
end