This changes is to make API UV.queue_work more safer.
Since uv_work_cb would be always runned on separate thread as mruby runs, running block on it will break running context of mruby.
On new mruby-uv uv_work_cb, it can only run cfunc proc that can run separately with mrb_state that is passed to UV.queue_work as argument.
(The cfunc would be called with arguments NULL, mrb_nil_value() and returned value would be discarded.)
And the block passed to UV.queue_work would be runned on uv_after_work_cb.
(See the test codes for detail. It will run summing of 0 to 99 on other thread.)
This changes is to make API
UV.queue_work
more safer. Sinceuv_work_cb
would be always runned on separate thread as mruby runs, running block on it will break running context of mruby. On new mruby-uvuv_work_cb
, it can only run cfunc proc that can run separately withmrb_state
that is passed toUV.queue_work
as argument. (The cfunc would be called with argumentsNULL, mrb_nil_value()
and returned value would be discarded.) And the block passed toUV.queue_work
would be runned onuv_after_work_cb
. (See the test codes for detail. It will run summing of 0 to 99 on other thread.)