From 74c23a237ef5245b63eb06b832a511aabeb715c0 Mon Sep 17 00:00:00 2001 From: John Benediktsson Date: Wed, 29 Oct 2025 21:40:13 -0700 Subject: [PATCH] Merge pull request #25763 from mrjbq7/cancelled rename Cancelled to Canceled --- lib/std/Build/Watch.zig | 2 +- lib/std/Io/test.zig | 2 +- lib/std/Thread/Futex.zig | 16 ++++++++-------- lib/std/os/linux/IoUring.zig | 4 ++-- lib/std/os/windows.zig | 8 ++++---- lib/std/os/windows/win32error.zig | 2 +- 6 files changed, 17 insertions(+), 17 deletions(-) diff --git a/lib/std/Build/Watch.zig b/lib/std/Build/Watch.zig index 9f393ca268..3213a9a24d 100644 --- a/lib/std/Build/Watch.zig +++ b/lib/std/Build/Watch.zig @@ -615,7 +615,7 @@ const Os = switch (builtin.os.tag) { }, .Timeout => break .timeout, // This status is issued because CancelIo was called, skip and try again. - .Cancelled => continue, + .Canceled => continue, else => break error.Unexpected, }; } diff --git a/lib/std/Io/test.zig b/lib/std/Io/test.zig index 52aca5ddcf..bc905232c0 100644 --- a/lib/std/Io/test.zig +++ b/lib/std/Io/test.zig @@ -167,7 +167,7 @@ test "Group cancellation" { fn sleep(io: Io, result: *usize) void { // 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 {}; result.* = 1; } diff --git a/lib/std/Thread/Futex.zig b/lib/std/Thread/Futex.zig index 0047f5400e..6c7b58a540 100644 --- a/lib/std/Thread/Futex.zig +++ b/lib/std/Thread/Futex.zig @@ -796,10 +796,10 @@ const PosixImpl = struct { var pending = bucket.pending.fetchAdd(1, .acquire); 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. - var cancelled = false; - defer if (cancelled) { + var canceled = false; + defer if (canceled) { pending = bucket.pending.fetchSub(1, .monotonic); assert(pending > 0); }; @@ -809,8 +809,8 @@ const PosixImpl = struct { assert(c.pthread_mutex_lock(&bucket.mutex) == .SUCCESS); defer assert(c.pthread_mutex_unlock(&bucket.mutex) == .SUCCESS); - cancelled = ptr.load(.monotonic) != expect; - if (cancelled) { + canceled = ptr.load(.monotonic) != expect; + if (canceled) { 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. // 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. - 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); defer assert(c.pthread_mutex_unlock(&bucket.mutex) == .SUCCESS); - cancelled = WaitQueue.tryRemove(&bucket.treap, address, &waiter); - if (cancelled) { + canceled = WaitQueue.tryRemove(&bucket.treap, address, &waiter); + if (canceled) { return error.Timeout; } }; diff --git a/lib/std/os/linux/IoUring.zig b/lib/std/os/linux/IoUring.zig index 60c24be227..54b4a5bd38 100644 --- a/lib/std/os/linux/IoUring.zig +++ b/lib/std/os/linux/IoUring.zig @@ -848,7 +848,7 @@ pub fn timeout( /// /// 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 /// `-ENOENT` if the timeout was not found. pub fn timeout_remove( @@ -972,7 +972,7 @@ pub fn statx( /// /// 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 /// `-ENOENT` if the operation was not found. pub fn cancel( diff --git a/lib/std/os/windows.zig b/lib/std/os/windows.zig index 19b6f8169d..b3294d48af 100644 --- a/lib/std/os/windows.zig +++ b/lib/std/os/windows.zig @@ -522,7 +522,7 @@ pub fn PostQueuedCompletionStatus( pub const GetQueuedCompletionStatusResult = enum { Normal, Aborted, - Cancelled, + Canceled, EOF, Timeout, }; @@ -543,7 +543,7 @@ pub fn GetQueuedCompletionStatus( ) == FALSE) { switch (GetLastError()) { .ABANDONED_WAIT_0 => return GetQueuedCompletionStatusResult.Aborted, - .OPERATION_ABORTED => return GetQueuedCompletionStatusResult.Cancelled, + .OPERATION_ABORTED => return GetQueuedCompletionStatusResult.Canceled, .HANDLE_EOF => return GetQueuedCompletionStatusResult.EOF, .WAIT_TIMEOUT => return GetQueuedCompletionStatusResult.Timeout, else => |err| { @@ -559,7 +559,7 @@ pub fn GetQueuedCompletionStatus( pub const GetQueuedCompletionStatusError = error{ Aborted, - Cancelled, + Canceled, EOF, Timeout, } || UnexpectedError; @@ -584,7 +584,7 @@ pub fn GetQueuedCompletionStatusEx( if (success == FALSE) { return switch (GetLastError()) { .ABANDONED_WAIT_0 => error.Aborted, - .OPERATION_ABORTED => error.Cancelled, + .OPERATION_ABORTED => error.Canceled, .HANDLE_EOF => error.EOF, .WAIT_TIMEOUT => error.Timeout, else => |err| unexpectedError(err), diff --git a/lib/std/os/windows/win32error.zig b/lib/std/os/windows/win32error.zig index 1bd3803332..a71256228c 100644 --- a/lib/std/os/windows/win32error.zig +++ b/lib/std/os/windows/win32error.zig @@ -624,7 +624,7 @@ pub const Win32Error = enum(u16) { DATA_NOT_ACCEPTED = 592, /// NTVDM encountered a hard error. 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, /// {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,