mirror of
https://github.com/ruby/ruby.git
synced 2025-09-15 08:33:58 +02:00
Remove dependency on fiddle from test/ruby
Co-authored-by: "Nobuyoshi Nakada" <nobu@ruby-lang.org>
This commit is contained in:
parent
8ff5458c2e
commit
892849ac98
3 changed files with 27 additions and 7 deletions
3
ext/-test-/thread/id/extconf.rb
Normal file
3
ext/-test-/thread/id/extconf.rb
Normal file
|
@ -0,0 +1,3 @@
|
|||
if have_func("gettid")
|
||||
create_makefile("-test-/thread/id")
|
||||
end
|
15
ext/-test-/thread/id/id.c
Normal file
15
ext/-test-/thread/id/id.c
Normal file
|
@ -0,0 +1,15 @@
|
|||
#include <ruby.h>
|
||||
|
||||
static VALUE
|
||||
bug_gettid(VALUE self)
|
||||
{
|
||||
pid_t tid = gettid();
|
||||
return PIDT2NUM(tid);
|
||||
}
|
||||
|
||||
void
|
||||
Init_id(void)
|
||||
{
|
||||
VALUE klass = rb_define_module_under(rb_define_module("Bug"), "ThreadID");
|
||||
rb_define_module_function(klass, "gettid", bug_gettid, 0);
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue