Commit 74c23a237e

John Benediktsson <mrjbq7@gmail.com>
2025-10-30 05:40:13
Merge pull request #25763 from mrjbq7/cancelled
rename Cancelled to Canceled
1 parent 1d80c95
Changed files (6)
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,
             };
         }
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;
 }
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(
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,
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),
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;
             }
         };