-
Notifications
You must be signed in to change notification settings - Fork 32
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
fibers does not support wait-operation being interrupted, even when on a non-fibers thread #99
Comments
That code is broken in the first place -- the async from system-async-mark can be run inside another fiber (or even not in a fiber at all, e.g. Fiber's scheduling code), in particular it could be somewhere outside the call-with-prompt. So, what's this code supposed to implement in the first place? |
The lambda from system-async-mark will be run in a separate thread, not in a fiber. The original goal is to implement interruptable evaluation and here is a working implementation: |
I did not notice the That seems much more reasonable. I am, however, quoting what I wrote in #29 (comment) (not all of it applies here, but enough does):
(This applies more generally, beyond Scheme and Fibers, to any APIs with concurrency.) |
(Also, pipe trick would be convenient here.) |
@emixa-d What do you mean by pipe trick? |
See, e.g., https://web.stanford.edu/class/cs110l/slides/lecture-11.pdf:
Pipes have a positive, but finite, buffer size, so make sure not to write too much to the pipe. |
I was experimenting with system-async-mark and found the problem with condition variables. I guess it happens because when async does non-local exit, the thread can not be removed from condition variable waiters and signaling fiber is hanging indefinitely.
The following code hangs on
signal-condition!
invocation:The output is following:
The text was updated successfully, but these errors were encountered: