Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Force cfunc in queue_work's work_cb and add test for it. #32

Merged
merged 1 commit into from
Apr 19, 2014

Conversation

take-cheeze
Copy link
Contributor

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.)

@mattn
Copy link
Owner

mattn commented Apr 19, 2014

SGTM

mattn added a commit that referenced this pull request Apr 19, 2014
Force cfunc in queue_work's work_cb and add test for it.
@mattn mattn merged commit 177c618 into mattn:master Apr 19, 2014
@mattn
Copy link
Owner

mattn commented Apr 19, 2014

Than you

@take-cheeze take-cheeze deleted the uv_queue_work branch April 22, 2014 08:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants