Last active
December 11, 2015 04:18
-
-
Save jimblandy/4543764 to your computer and use it in GitHub Desktop.
Operation callback testing API
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
triggerOperationCallback([delay]) | |
Trigger an operation callback. | |
If 'delay' is given, it must be a positive integer; wait that many operation | |
callback opportunities to trigger the callback. (Note that delay counts only | |
work when we are running a body function from 'withOperationCallback'.) | |
withOperationCallback(body, [callback]) | |
Call the function 'body', establishing the function 'callback' as the | |
operation callback while 'body' runs. Once 'body' completes, restore the | |
runtime's original operation callback. Return whatever value or throw whatever | |
exception 'body' did. | |
If 'callback' returns normally, resume execution in 'body'. If 'callback' | |
returns a positive integer, trigger another operation callback after that many | |
operation callback opportunities have passed. (Thus, if 'callback' returns | |
zero, trigger another operation callback at the next opportunity.) | |
If 'callback' throws or is terminated, then that is propagated to 'body'. | |
While 'callback' runs, we temporarily restore the original operation callback. | |
When we resume execution in 'body', 'callback' is reinstated. | |
If 'callback' is omitted, then let triggering an operation callback simply | |
terminate the execution of 'body' (as if by the 'terminate' function). |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment