Skip to content

Modern Chan IsCancelled

Paul Squires edited this page Oct 19, 2026 · 5 revisions

Home › Goroutines and Channels › Goroutines and Channels › IsCancelled

IsCancelled

Returns true once the context is cancelled or its deadline has passed.

Syntax

IsCancelled( )

Examples

#import "std/tasks"
using tasks

dim root as Context
dim ctx as CancelContext = WithCancel( root )

print ctx.IsCancelled( )     '' false
ctx.Cancel( )
print ctx.IsCancelled( )     '' true

'' A poll, for a loop that can check between units of work:
''     do while not ctx.IsCancelled( )
''         ... one chunk ...
''     loop
''
'' To BLOCK until cancellation instead, select on Done( ) -- a closed
'' channel is permanently ready, so that case fires at once and forever.

Library: Goroutines and Channels
Category: Goroutines and Channels
Documented under: Context

Clone this wiki locally