Merge pull request #25763 from mrjbq7/cancelled

rename Cancelled to Canceled
This commit is contained in:
John Benediktsson 2025-10-29 21:40:13 -07:00 committed by GitHub
parent 1d80c9540a
commit 74c23a237e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 17 additions and 17 deletions

View file

@ -615,7 +615,7 @@ const Os = switch (builtin.os.tag) {
}, },
.Timeout => break .timeout, .Timeout => break .timeout,
// This status is issued because CancelIo was called, skip and try again. // This status is issued because CancelIo was called, skip and try again.
.Cancelled => continue, .Canceled => continue,
else => break error.Unexpected, else => break error.Unexpected,
}; };
} }

View file

@ -167,7 +167,7 @@ test "Group cancellation" {
fn sleep(io: Io, result: *usize) void { fn sleep(io: Io, result: *usize) void {
// TODO when cancellation race bug is fixed, make this timeout much longer so that // TODO when cancellation race bug is fixed, make this timeout much longer so that
// it causes the unit test to be failed if not cancelled. // it causes the unit test to be failed if not canceled.
io.sleep(.fromMilliseconds(1), .awake) catch {}; io.sleep(.fromMilliseconds(1), .awake) catch {};
result.* = 1; result.* = 1;
} }

View file

@ -796,10 +796,10 @@ const PosixImpl = struct {
var pending = bucket.pending.fetchAdd(1, .acquire); var pending = bucket.pending.fetchAdd(1, .acquire);
assert(pending < std.math.maxInt(usize)); assert(pending < std.math.maxInt(usize));
// If the wait gets cancelled, remove the pending count we previously added. // If the wait gets canceled, remove the pending count we previously added.
// This is done outside the mutex lock to keep the critical section short in case of contention. // This is done outside the mutex lock to keep the critical section short in case of contention.
var cancelled = false; var canceled = false;
defer if (cancelled) { defer if (canceled) {
pending = bucket.pending.fetchSub(1, .monotonic); pending = bucket.pending.fetchSub(1, .monotonic);
assert(pending > 0); assert(pending > 0);
}; };
@ -809,8 +809,8 @@ const PosixImpl = struct {
assert(c.pthread_mutex_lock(&bucket.mutex) == .SUCCESS); assert(c.pthread_mutex_lock(&bucket.mutex) == .SUCCESS);
defer assert(c.pthread_mutex_unlock(&bucket.mutex) == .SUCCESS); defer assert(c.pthread_mutex_unlock(&bucket.mutex) == .SUCCESS);
cancelled = ptr.load(.monotonic) != expect; canceled = ptr.load(.monotonic) != expect;
if (cancelled) { if (canceled) {
return; return;
} }
@ -827,13 +827,13 @@ const PosixImpl = struct {
// If we fail to cancel after a timeout, it means a wake() thread dequeued us and will wake us up. // If we fail to cancel after a timeout, it means a wake() thread dequeued us and will wake us up.
// We must wait until the event is set as that's a signal that the wake() thread won't access the waiter memory anymore. // We must wait until the event is set as that's a signal that the wake() thread won't access the waiter memory anymore.
// If we return early without waiting, the waiter on the stack would be invalidated and the wake() thread risks a UAF. // If we return early without waiting, the waiter on the stack would be invalidated and the wake() thread risks a UAF.
defer if (!cancelled) waiter.event.wait(null) catch unreachable; defer if (!canceled) waiter.event.wait(null) catch unreachable;
assert(c.pthread_mutex_lock(&bucket.mutex) == .SUCCESS); assert(c.pthread_mutex_lock(&bucket.mutex) == .SUCCESS);
defer assert(c.pthread_mutex_unlock(&bucket.mutex) == .SUCCESS); defer assert(c.pthread_mutex_unlock(&bucket.mutex) == .SUCCESS);
cancelled = WaitQueue.tryRemove(&bucket.treap, address, &waiter); canceled = WaitQueue.tryRemove(&bucket.treap, address, &waiter);
if (cancelled) { if (canceled) {
return error.Timeout; return error.Timeout;
} }
}; };

View file

@ -848,7 +848,7 @@ pub fn timeout(
/// ///
/// The timeout is identified by its `user_data`. /// The timeout is identified by its `user_data`.
/// ///
/// The completion event result will be `0` if the timeout was found and cancelled successfully, /// The completion event result will be `0` if the timeout was found and canceled successfully,
/// `-EBUSY` if the timeout was found but expiration was already in progress, or /// `-EBUSY` if the timeout was found but expiration was already in progress, or
/// `-ENOENT` if the timeout was not found. /// `-ENOENT` if the timeout was not found.
pub fn timeout_remove( pub fn timeout_remove(
@ -972,7 +972,7 @@ pub fn statx(
/// ///
/// The operation is identified by its `user_data`. /// The operation is identified by its `user_data`.
/// ///
/// The completion event result will be `0` if the operation was found and cancelled successfully, /// The completion event result will be `0` if the operation was found and canceled successfully,
/// `-EALREADY` if the operation was found but was already in progress, or /// `-EALREADY` if the operation was found but was already in progress, or
/// `-ENOENT` if the operation was not found. /// `-ENOENT` if the operation was not found.
pub fn cancel( pub fn cancel(

View file

@ -522,7 +522,7 @@ pub fn PostQueuedCompletionStatus(
pub const GetQueuedCompletionStatusResult = enum { pub const GetQueuedCompletionStatusResult = enum {
Normal, Normal,
Aborted, Aborted,
Cancelled, Canceled,
EOF, EOF,
Timeout, Timeout,
}; };
@ -543,7 +543,7 @@ pub fn GetQueuedCompletionStatus(
) == FALSE) { ) == FALSE) {
switch (GetLastError()) { switch (GetLastError()) {
.ABANDONED_WAIT_0 => return GetQueuedCompletionStatusResult.Aborted, .ABANDONED_WAIT_0 => return GetQueuedCompletionStatusResult.Aborted,
.OPERATION_ABORTED => return GetQueuedCompletionStatusResult.Cancelled, .OPERATION_ABORTED => return GetQueuedCompletionStatusResult.Canceled,
.HANDLE_EOF => return GetQueuedCompletionStatusResult.EOF, .HANDLE_EOF => return GetQueuedCompletionStatusResult.EOF,
.WAIT_TIMEOUT => return GetQueuedCompletionStatusResult.Timeout, .WAIT_TIMEOUT => return GetQueuedCompletionStatusResult.Timeout,
else => |err| { else => |err| {
@ -559,7 +559,7 @@ pub fn GetQueuedCompletionStatus(
pub const GetQueuedCompletionStatusError = error{ pub const GetQueuedCompletionStatusError = error{
Aborted, Aborted,
Cancelled, Canceled,
EOF, EOF,
Timeout, Timeout,
} || UnexpectedError; } || UnexpectedError;
@ -584,7 +584,7 @@ pub fn GetQueuedCompletionStatusEx(
if (success == FALSE) { if (success == FALSE) {
return switch (GetLastError()) { return switch (GetLastError()) {
.ABANDONED_WAIT_0 => error.Aborted, .ABANDONED_WAIT_0 => error.Aborted,
.OPERATION_ABORTED => error.Cancelled, .OPERATION_ABORTED => error.Canceled,
.HANDLE_EOF => error.EOF, .HANDLE_EOF => error.EOF,
.WAIT_TIMEOUT => error.Timeout, .WAIT_TIMEOUT => error.Timeout,
else => |err| unexpectedError(err), else => |err| unexpectedError(err),

View file

@ -624,7 +624,7 @@ pub const Win32Error = enum(u16) {
DATA_NOT_ACCEPTED = 592, DATA_NOT_ACCEPTED = 592,
/// NTVDM encountered a hard error. /// NTVDM encountered a hard error.
VDM_HARD_ERROR = 593, VDM_HARD_ERROR = 593,
/// {Cancel Timeout} The driver %hs failed to complete a cancelled I/O request in the allotted time. /// {Cancel Timeout} The driver %hs failed to complete a canceled I/O request in the allotted time.
DRIVER_CANCEL_TIMEOUT = 594, DRIVER_CANCEL_TIMEOUT = 594,
/// {Reply Message Mismatch} An attempt was made to reply to an LPC message, but the thread specified by the client ID in the message was not waiting on that message. /// {Reply Message Mismatch} An attempt was made to reply to an LPC message, but the thread specified by the client ID in the message was not waiting on that message.
REPLY_MESSAGE_MISMATCH = 595, REPLY_MESSAGE_MISMATCH = 595,