mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
thread.c: function cast
* ext/thread/thread.c (queue_sleep): get rid of casting function pointer. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42878 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
9b6ee42d86
commit
398c3cab6d
1 changed files with 8 additions and 1 deletions
|
@ -255,6 +255,13 @@ queue_delete_from_waiting(struct waiting_delete *p)
|
||||||
return Qnil;
|
return Qnil;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static VALUE
|
||||||
|
queue_sleep(VALUE arg)
|
||||||
|
{
|
||||||
|
rb_thread_sleep_deadly();
|
||||||
|
return Qnil;
|
||||||
|
}
|
||||||
|
|
||||||
static VALUE
|
static VALUE
|
||||||
queue_do_pop(VALUE self, VALUE should_block)
|
queue_do_pop(VALUE self, VALUE should_block)
|
||||||
{
|
{
|
||||||
|
@ -267,7 +274,7 @@ queue_do_pop(VALUE self, VALUE should_block)
|
||||||
rb_raise(rb_eThreadError, "queue empty");
|
rb_raise(rb_eThreadError, "queue empty");
|
||||||
}
|
}
|
||||||
rb_ary_push(args.waiting, args.th);
|
rb_ary_push(args.waiting, args.th);
|
||||||
rb_ensure((VALUE (*)())rb_thread_sleep_deadly, (VALUE)0, queue_delete_from_waiting, (VALUE)&args);
|
rb_ensure(queue_sleep, (VALUE)0, queue_delete_from_waiting, (VALUE)&args);
|
||||||
}
|
}
|
||||||
|
|
||||||
return rb_ary_shift(GET_QUEUE_QUE(self));
|
return rb_ary_shift(GET_QUEUE_QUE(self));
|
||||||
|
|
Loading…
Reference in a new issue