Module Cancellation.Expert

val globalize : t @ local -> t

globalize t is t @ global.

Cancellation tokens are generally strictly scoped as they are implicitly canceled at the end of their scope. Within a token's scope, however, one may e.g. need to link to it from a newly spawned thread or domain and in that case one the token needs to be globalized.

val create : unit -> t

create () creates a fresh unscoped cancellation token.

Cancellation tokens are generally strictly scoped. When using an unscoped token one should arrange for the token to be canceled after it is no longer needed to ensure that any attached resources will be cleaned up.