-
Notifications
You must be signed in to change notification settings - Fork 550
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
Rework Interruptible monad #6889
Conversation
*) | ||
type ('a, 's) t | ||
|
||
include Monad.S2 with type ('a, 's) t := ('a, 's) 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.
might be nice to have a comment that says this provides bind
, map
, and return
let%map () = wait 100. in | ||
assert (!r = 2) ) | ||
|
||
let%test_unit "interruptions branches do not cancel eachother" = |
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.
each other
|
||
(** The type of interruptible computations. | ||
[('a, 's) t] represents a computation that produces a value of type ['a], | ||
but which may be interrupted by a signal of type ['s]. |
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.
might be nice to say what a "signal" is in this context (it's not a Unix signal)
This PR rewrites the interruptible monad to behave correctly. In particular, this changes the semantics around binding so that
has the same behaviour as
This was not the case in either the original version or the tweaked implementation in #6880. Presumably this was causing issues in
Integration_test_cloud_engine.Stack_driver_log_engine.pull_subscription_in_background
, which calls itself infinitely in this nested-bind style.This also adds unit tests for these cases, and fixes the existing unit test (which was equivalent to
Async.after (Time.Span.of_ms 130.)
).Checklist:
Closes #300.