mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
Add support for non-blocking Process.wait
.
This commit is contained in:
parent
a4a92ae6d9
commit
2553c5f94a
Notes:
git
2020-12-09 04:56:08 +09:00
10 changed files with 262 additions and 46 deletions
14
scheduler.c
14
scheduler.c
|
@ -18,6 +18,7 @@ static ID id_block;
|
|||
static ID id_unblock;
|
||||
|
||||
static ID id_kernel_sleep;
|
||||
static ID id_process_wait;
|
||||
|
||||
static ID id_io_read;
|
||||
static ID id_io_write;
|
||||
|
@ -32,6 +33,7 @@ Init_Scheduler(void)
|
|||
id_unblock = rb_intern_const("unblock");
|
||||
|
||||
id_kernel_sleep = rb_intern_const("kernel_sleep");
|
||||
id_process_wait = rb_intern_const("process_wait");
|
||||
|
||||
id_io_read = rb_intern_const("io_read");
|
||||
id_io_write = rb_intern_const("io_write");
|
||||
|
@ -118,6 +120,18 @@ rb_scheduler_kernel_sleepv(VALUE scheduler, int argc, VALUE * argv)
|
|||
return rb_funcallv(scheduler, id_kernel_sleep, argc, argv);
|
||||
}
|
||||
|
||||
int
|
||||
rb_scheduler_supports_process_wait(VALUE scheduler)
|
||||
{
|
||||
return rb_respond_to(scheduler, id_process_wait);
|
||||
}
|
||||
|
||||
VALUE
|
||||
rb_scheduler_process_wait(VALUE scheduler, rb_pid_t pid, int flags)
|
||||
{
|
||||
return rb_funcall(scheduler, id_process_wait, 2, PIDT2NUM(pid), RB_INT2NUM(flags));
|
||||
}
|
||||
|
||||
VALUE
|
||||
rb_scheduler_block(VALUE scheduler, VALUE blocker, VALUE timeout)
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue