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

Implement Fiber#transfer. #1900

Merged
merged 2 commits into from
Mar 21, 2014
Merged

Implement Fiber#transfer. #1900

merged 2 commits into from
Mar 21, 2014

Conversation

take-cheeze
Copy link
Contributor

This Fiber#transfer doesn't have compatibility with CRuby's.
On CRuby context has field transferred to check context is transferring though this version doesn't have it.
So transferred context can resume as long as it won't hit normal resume limit.
And transfer to root context is allowed in CRuby but on this implementation it isn't allowed.

What this Fiber#transfer does is that it replaces current running context with transferring context.
Since it use fiber_resume() internally to do it, the limitation of transfer is similar to resume.

@matz
Copy link
Member

matz commented Mar 21, 2014

I am not sure yet how much significant this incompatibility is.
Any opinion?

@bjorndm
Copy link

bjorndm commented Mar 21, 2014

Well, Fiber is not part of the ISO standard anyway, so, in that case, I think cruby compatibility is nice if it can be done without making mruby too heavy. This is just a small change with one extra function really, so I think it's OK add this.

@take-cheeze
Copy link
Contributor Author

After reading few implementations I've reimplemented CRuby compatible one.
It can now break from nested fiber call.

matz added a commit that referenced this pull request Mar 21, 2014
@matz matz merged commit 6a458ab into mruby:master Mar 21, 2014
matz added a commit that referenced this pull request Mar 21, 2014
@take-cheeze take-cheeze deleted the fiber_transfer branch March 25, 2014 23:20
mattn pushed a commit to mattn/mruby that referenced this pull request Sep 11, 2015
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.

None yet

3 participants