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

Interop with Tarantool fibers #199

Open
aleclarson opened this issue Apr 27, 2018 · 3 comments
Open

Interop with Tarantool fibers #199

aleclarson opened this issue Apr 27, 2018 · 3 comments

Comments

@aleclarson
Copy link

aleclarson commented Apr 27, 2018

Do you have any suggestions on getting cqueues to work seamlessly with Tarantool fibers?

I've interposed step like this, which lets me call :step and :loop within a fiber.

Now I'm trying to get cq.poll() to not cause a "yield across C-call boundary" error when called within a fiber.

I think the issue is that cq.running() doesn't return nil when within a fiber, which make sense. Unfortunately, that behavior makes this line and this line problematic. If those two lines did select(2, cq.running()), it would ensure the current coroutine is a cqueue before doing a native poll.

I may need to handle this by monkey-patching fiber.create, but I'm curious if a simpler solution exists with cqueues. In the end, it may be easiest (but less convenient) to avoid fibers within cqueues at all costs. Thanks!

@aleclarson
Copy link
Author

Another issue: yielding the parent fiber from within a cqueue is nasty business. The cqueue will still think it's running, when in reality its parent fiber is suspended. This makes the return value of core.running incorrect.

@aleclarson
Copy link
Author

At this point, I think forking cqueues to use fibers is the right solution. But I'd like some feedback on this issue first, if possible.

@aleclarson
Copy link
Author

aleclarson commented Apr 28, 2018

On second thought, I think exposing Tarantool's scheduler so it can be driven with a cqueue could be a viable option. But maybe not, since coroutine.yield is used by cqueues, which Tarantool's scheduler may not like.

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

No branches or pull requests

1 participant