Awaits.jl
Awaits.Awaits
Awaits.cancel!
Awaits.@await
Awaits.@cancelscope
Awaits.@check
Awaits.@go
Awaits.@in
Awaits.@taskgroup
Awaits.Awaits
— Module.Awaits.cancel!
— Method.cancel!(context::TaskContext)
Cancel (stop) execution of task context
.
Awaits.@await
— Macro.@await body
Handle an exception returned from body
. If body
evaluates to an Exception
, it cancels all the tasks attached to the current context.
The variable _
in code like @await f(_, x, y)
is replaced by the current task context. It must be invoked inside @taskgroup
or @in
macros.
Awaits.@cancelscope
— Macro.@cancelscope(body) :: TaskContext
Create a task context with a new scope of cancellation. Tasks launched inside a @cancelscope
can be cancelled independently from the tasks outside to this scope. This scope returns a context object that can be used to cancel the task by calling cancel!
on this object.
Awaits.@check
— Macro.@check [context]
Check context
and exit the function (do return Cancelled()
) if it is required.
Awaits.@go
— Macro.@go body
A wrapper of Threads.@spawn
that makes cancellation work.
The variable _
in code like @go f(_, x, y)
is replaced by the current task context. It must be invoked inside @taskgroup
or @in
macros.
Awaits.@in
— Macro.@in context body
Enter into the task context
so that other macros like @go
works as expected. This should be used inside a function in which the task context
is passed by a caller (for example, using @go f(_)
macro).
Awaits.@taskgroup
— Macro.@taskgroup(body)
Create a new task context. This is an extension of the @sync
block.