mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
Rename scheduler.{mutex_lock,mutex_unlock} to {block,unblock}
* Move #kernel_sleep next to #block as it is similar
This commit is contained in:
parent
c3acfcc78d
commit
738a089b3a
4 changed files with 28 additions and 25 deletions
16
scheduler.c
16
scheduler.c
|
@ -12,8 +12,8 @@
|
|||
#include "ruby/io.h"
|
||||
|
||||
static ID id_kernel_sleep;
|
||||
static ID id_mutex_lock;
|
||||
static ID id_mutex_unlock;
|
||||
static ID id_block;
|
||||
static ID id_unblock;
|
||||
static ID id_io_read;
|
||||
static ID id_io_write;
|
||||
static ID id_io_wait;
|
||||
|
@ -22,8 +22,8 @@ void
|
|||
Init_Scheduler(void)
|
||||
{
|
||||
id_kernel_sleep = rb_intern_const("kernel_sleep");
|
||||
id_mutex_lock = rb_intern_const("mutex_lock");
|
||||
id_mutex_unlock = rb_intern_const("mutex_unlock");
|
||||
id_block = rb_intern_const("block");
|
||||
id_unblock = rb_intern_const("unblock");
|
||||
id_io_read = rb_intern_const("io_read");
|
||||
id_io_write = rb_intern_const("io_write");
|
||||
id_io_wait = rb_intern_const("io_wait");
|
||||
|
@ -48,14 +48,14 @@ VALUE rb_scheduler_kernel_sleepv(VALUE scheduler, int argc, VALUE * argv)
|
|||
return rb_funcallv(scheduler, id_kernel_sleep, argc, argv);
|
||||
}
|
||||
|
||||
VALUE rb_scheduler_mutex_lock(VALUE scheduler, VALUE mutex)
|
||||
VALUE rb_scheduler_block(VALUE scheduler, VALUE blocker)
|
||||
{
|
||||
return rb_funcall(scheduler, id_mutex_lock, 1, mutex);
|
||||
return rb_funcall(scheduler, id_block, 1, blocker);
|
||||
}
|
||||
|
||||
VALUE rb_scheduler_mutex_unlock(VALUE scheduler, VALUE mutex, VALUE fiber)
|
||||
VALUE rb_scheduler_unblock(VALUE scheduler, VALUE blocker, VALUE fiber)
|
||||
{
|
||||
return rb_funcall(scheduler, id_mutex_unlock, 2, mutex, fiber);
|
||||
return rb_funcall(scheduler, id_unblock, 2, blocker, fiber);
|
||||
}
|
||||
|
||||
VALUE rb_scheduler_io_wait(VALUE scheduler, VALUE io, VALUE events, VALUE timeout)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue