Atom

task.cancel()

Requests cancellation.

Signature

task.cancel(handle)

Parameters

Owned coroutine or task.

Returns

Boolean indicating whether cancellation was requested/performed.

Behavior

Unwinds suspended coroutine finally blocks. For workers requests interruption. Timer cancellation wakes the wait.

Errors

Wrong owner/type or coroutine cleanup error.

Example

Atom
use task
func pause():
    yield 1
c = create(coroutine, pause)
task.resume(c)
assert(task.cancel(c))