-
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
Fix #37 #56
base: master
Are you sure you want to change the base?
Fix #37 #56
Conversation
Currently, if an exception is thrown in the initial fiber, RUN-FIBERS never returns, because the atomic box RET is never written to. This change makes it so RET is written to in case of both normal and exceptional exits, and any caught exception is re-thrown in the context of the caller.
Thanks! This one won't probably make it to 1.1.0. I believe it makes sense but I'd like to take a closer look. |
A test case is missing, to aid with verifying whether the change works, to avoid regressions later, and to assist with verifying future changes in this area of the code. |
(dynamic-wind | ||
(const #t) | ||
(lambda () | ||
(catch #t |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't use catch
, as it destroys all backtrace information. Instead use with-exception-handler
which doesn't destroy it (maybe with a fallback to 'catch' for old versions of Guile if it's not Guile 2.2). If you go for with-exception-handler
, also go for raise-continuable
instead of raise-exception
/raise
, otherwise you accumulate raise-exception
in the backtrace, which is harmless but noisy.
;; Could be that this fiber was migrated away. | ||
;; Make sure to wake up the main scheduler. | ||
(spawn-fiber (lambda () #t) scheduler)) | ||
(dynamic-wind |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Spacing seems wonky, though maybe that's just a different tabs / space convention (does someone know the conventions used in Fibers?).
(('ok vals) | ||
(apply values vals)) | ||
(('err args) | ||
(apply throw args))))))) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The raise-continuable
I mentioned would go here.
This is the proposed fix in #37.