Skip to content

Instantly share code, notes, and snippets.

@Artazor
Last active August 29, 2015 14:16
Show Gist options
  • Save Artazor/8777fb87865d778509c8 to your computer and use it in GitHub Desktop.
Save Artazor/8777fb87865d778509c8 to your computer and use it in GitHub Desktop.
Cancellation semantics

W.l.o.g we assume that all native cancellable activities are exposed to the JavasScript in the following form:

function doIt(
	options: any, 
	cb: (error: any, result: ResultType) => void
): CancellationHandle {
	[native code]
}

function cancelIt(ch: CancellationHandle): void {
	[native code]
}

where activity can be in one of three distinct states:

  • running - means that the
  • finished
  • cancelled

We call such activities as primary or atomic cancellable activies.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment