pub const CancelProtection = enum(u1) 1445
1446
1447
1448
1449
1450
1451
1452pub const CancelProtection = enum(u1) {
/// Any call to an `Io` function with `error.Canceled` in its error set is a cancelation point.
///
/// This is the default state, which all tasks are created in.
unblocked = 0,
/// No `Io` function introduces a cancelation point (`error.Canceled` will never be returned).
blocked = 1,
}
In rare cases, it is desirable to completely block cancelation notification, so that a region of code can run uninterrupted before
error.Canceledis potentially observed. Therefore, every task has a "cancel protection" state which indicates whether or notIofunctions can introduce cancelation points.To modify a task's cancel protection state, see
swapCancelProtection.For a description of cancelation and cancelation points, see
Future.cancel.