diff options
author | Lars Kanis <lars@greiz-reinsdorf.de> | 2021-03-05 10:59:47 +0100 |
---|---|---|
committer | Lars Kanis <lars@greiz-reinsdorf.de> | 2021-03-05 11:02:58 +0100 |
commit | 334c3afbd30df768974b9a228847fda027643c7d (patch) | |
tree | 4641700d719c3148fc71d8d8d3fc265031797fd3 | |
parent | 1cce06db0b774ee46ef98ea9ca6ceec5d21694a4 (diff) | |
download | ffi-334c3afbd30df768974b9a228847fda027643c7d.tar.gz |
Use shorter thread names for FFI's callbacks
The thread name is truncated in gdb to 15 characters, so that there was no distiction between "Callback Runner" and "Callback Dispatcher".
-rw-r--r-- | ext/ffi_c/Function.c | 4 | ||||
-rw-r--r-- | spec/ffi/async_callback_spec.rb | 2 | ||||
-rw-r--r-- | spec/ffi/function_spec.rb | 2 |
3 files changed, 4 insertions, 4 deletions
diff --git a/ext/ffi_c/Function.c b/ext/ffi_c/Function.c index 30478d9..11d0a6d 100644 --- a/ext/ffi_c/Function.c +++ b/ext/ffi_c/Function.c @@ -311,7 +311,7 @@ function_init(VALUE self, VALUE rbFunctionInfo, VALUE rbProc) if (async_cb_thread == Qnil) { async_cb_thread = rb_thread_create(async_cb_event, NULL); /* Name thread, for better debugging */ - rb_funcall(async_cb_thread, rb_intern("name="), 1, rb_str_new2("FFI::Function Callback Dispatcher")); + rb_funcall(async_cb_thread, rb_intern("name="), 1, rb_str_new2("FFI Callback Dispatcher")); } #endif @@ -529,7 +529,7 @@ async_cb_event(void* unused) /* Start up a new ruby thread to run the ruby callback */ VALUE new_thread = rb_thread_create(async_cb_call, w.cb); /* Name thread, for better debugging */ - rb_funcall(new_thread, rb_intern("name="), 1, rb_str_new2("FFI::Function Callback Runner")); + rb_funcall(new_thread, rb_intern("name="), 1, rb_str_new2("FFI Callback Runner")); } } diff --git a/spec/ffi/async_callback_spec.rb b/spec/ffi/async_callback_spec.rb index d770355..51a4886 100644 --- a/spec/ffi/async_callback_spec.rb +++ b/spec/ffi/async_callback_spec.rb @@ -48,6 +48,6 @@ describe "async callback" do LibTest.testAsyncCallback(proc { callback_runner_thread = Thread.current }, 0) - expect(callback_runner_thread.name).to eq("FFI::Function Callback Runner") + expect(callback_runner_thread.name).to eq("FFI Callback Runner") end end diff --git a/spec/ffi/function_spec.rb b/spec/ffi/function_spec.rb index a7d6dc7..5bc2421 100644 --- a/spec/ffi/function_spec.rb +++ b/spec/ffi/function_spec.rb @@ -26,7 +26,7 @@ describe FFI::Function do skip 'this is MRI-specific' if RUBY_ENGINE == 'truffleruby' || RUBY_ENGINE == 'jruby' FFI::Function.new(:int, []) { 5 } # Trigger initialization - expect(Thread.list.map(&:name)).to include('FFI::Function Callback Dispatcher') + expect(Thread.list.map(&:name)).to include('FFI Callback Dispatcher') end end |