mirror of
https://github.com/mruby/mruby
synced 2026-06-08 16:11:16 +00:00
Add mrb_fiber_alive_p to C API.
This commit is contained in:
@@ -1225,6 +1225,13 @@ MRB_API mrb_value mrb_fiber_resume(mrb_state *mrb, mrb_value fib, mrb_int argc,
|
||||
*/
|
||||
MRB_API mrb_value mrb_fiber_yield(mrb_state *mrb, mrb_int argc, const mrb_value *argv);
|
||||
|
||||
/*
|
||||
* Check if a Fiber is alive
|
||||
*
|
||||
* @mrbgem mruby-fiber
|
||||
*/
|
||||
MRB_API mrb_value mrb_fiber_alive_p(mrb_state *mrb, mrb_value fib);
|
||||
|
||||
/*
|
||||
* FiberError reference
|
||||
*
|
||||
|
||||
@@ -274,12 +274,13 @@ mrb_fiber_resume(mrb_state *mrb, mrb_value fib, mrb_int len, const mrb_value *a)
|
||||
* Returns true if the fiber can still be resumed. After finishing
|
||||
* execution of the fiber block this method will always return false.
|
||||
*/
|
||||
static mrb_value
|
||||
fiber_alive_p(mrb_state *mrb, mrb_value self)
|
||||
MRB_API mrb_value
|
||||
mrb_fiber_alive_p(mrb_state *mrb, mrb_value self)
|
||||
{
|
||||
struct mrb_context *c = fiber_check(mrb, self);
|
||||
return mrb_bool_value(c->status != MRB_FIBER_TERMINATED);
|
||||
}
|
||||
#define fiber_alive_p mrb_fiber_alive_p
|
||||
|
||||
static mrb_value
|
||||
fiber_eq(mrb_state *mrb, mrb_value self)
|
||||
|
||||
Reference in New Issue
Block a user