authorgravatar for mrjbq7@gmail.comJohn Benediktsson <mrjbq7@gmail.com> 2025-10-29 21:40:13-07:00
committergravatar for noreply@github.comGitHub <noreply@github.com> 2025-10-30 04:40:13+00:00
log74c23a237ef5245b63eb06b832a511aabeb715c0
tree761a4a85b78662a83078a18f1a49973c22854ed0
parent1d80c9540af9b3c577c8cca740247b968e7e59f1
signaturebadge-check Signed by PGP key B5690EEEBB952194

Merge pull request #25763 from mrjbq7/cancelled

rename Cancelled to Canceled

6 files changed, 17 insertions(+), 17 deletions(-)

lib/std/Build/Watch.zig+1-1
...@@ -615,7 +615,7 @@ const Os = switch (builtin.os.tag) {...@@ -615,7 +615,7 @@ const Os = switch (builtin.os.tag) {
615 },615 },
616 .Timeout => break .timeout,616 .Timeout => break .timeout,
617 // This status is issued because CancelIo was called, skip and try again.617 // This status is issued because CancelIo was called, skip and try again.
618 .Cancelled => continue,618 .Canceled => continue,
619 else => break error.Unexpected,619 else => break error.Unexpected,
620 };620 };
621 }621 }
lib/std/Io/test.zig+1-1
...@@ -167,7 +167,7 @@ test "Group cancellation" {...@@ -167,7 +167,7 @@ test "Group cancellation" {
167167
168fn sleep(io: Io, result: *usize) void {168fn sleep(io: Io, result: *usize) void {
169 // TODO when cancellation race bug is fixed, make this timeout much longer so that169 // TODO when cancellation race bug is fixed, make this timeout much longer so that
170 // it causes the unit test to be failed if not cancelled.170 // it causes the unit test to be failed if not canceled.
171 io.sleep(.fromMilliseconds(1), .awake) catch {};171 io.sleep(.fromMilliseconds(1), .awake) catch {};
172 result.* = 1;172 result.* = 1;
173}173}
lib/std/Thread/Futex.zig+8-8
...@@ -796,10 +796,10 @@ const PosixImpl = struct {...@@ -796,10 +796,10 @@ const PosixImpl = struct {
796 var pending = bucket.pending.fetchAdd(1, .acquire);796 var pending = bucket.pending.fetchAdd(1, .acquire);
797 assert(pending < std.math.maxInt(usize));797 assert(pending < std.math.maxInt(usize));
798798
799 // If the wait gets cancelled, remove the pending count we previously added.799 // If the wait gets canceled, remove the pending count we previously added.
800 // This is done outside the mutex lock to keep the critical section short in case of contention.800 // This is done outside the mutex lock to keep the critical section short in case of contention.
801 var cancelled = false;801 var canceled = false;
802 defer if (cancelled) {802 defer if (canceled) {
803 pending = bucket.pending.fetchSub(1, .monotonic);803 pending = bucket.pending.fetchSub(1, .monotonic);
804 assert(pending > 0);804 assert(pending > 0);
805 };805 };
...@@ -809,8 +809,8 @@ const PosixImpl = struct {...@@ -809,8 +809,8 @@ const PosixImpl = struct {
809 assert(c.pthread_mutex_lock(&bucket.mutex) == .SUCCESS);809 assert(c.pthread_mutex_lock(&bucket.mutex) == .SUCCESS);
810 defer assert(c.pthread_mutex_unlock(&bucket.mutex) == .SUCCESS);810 defer assert(c.pthread_mutex_unlock(&bucket.mutex) == .SUCCESS);
811811
812 cancelled = ptr.load(.monotonic) != expect;812 canceled = ptr.load(.monotonic) != expect;
813 if (cancelled) {813 if (canceled) {
814 return;814 return;
815 }815 }
816816
...@@ -827,13 +827,13 @@ const PosixImpl = struct {...@@ -827,13 +827,13 @@ const PosixImpl = struct {
827 // If we fail to cancel after a timeout, it means a wake() thread dequeued us and will wake us up.827 // If we fail to cancel after a timeout, it means a wake() thread dequeued us and will wake us up.
828 // We must wait until the event is set as that's a signal that the wake() thread won't access the waiter memory anymore.828 // We must wait until the event is set as that's a signal that the wake() thread won't access the waiter memory anymore.
829 // If we return early without waiting, the waiter on the stack would be invalidated and the wake() thread risks a UAF.829 // If we return early without waiting, the waiter on the stack would be invalidated and the wake() thread risks a UAF.
830 defer if (!cancelled) waiter.event.wait(null) catch unreachable;830 defer if (!canceled) waiter.event.wait(null) catch unreachable;
831831
832 assert(c.pthread_mutex_lock(&bucket.mutex) == .SUCCESS);832 assert(c.pthread_mutex_lock(&bucket.mutex) == .SUCCESS);
833 defer assert(c.pthread_mutex_unlock(&bucket.mutex) == .SUCCESS);833 defer assert(c.pthread_mutex_unlock(&bucket.mutex) == .SUCCESS);
834834
835 cancelled = WaitQueue.tryRemove(&bucket.treap, address, &waiter);835 canceled = WaitQueue.tryRemove(&bucket.treap, address, &waiter);
836 if (cancelled) {836 if (canceled) {
837 return error.Timeout;837 return error.Timeout;
838 }838 }
839 };839 };
lib/std/os/linux/IoUring.zig+2-2
...@@ -848,7 +848,7 @@ pub fn timeout(...@@ -848,7 +848,7 @@ pub fn timeout(
848///848///
849/// The timeout is identified by its `user_data`.849/// The timeout is identified by its `user_data`.
850///850///
851/// The completion event result will be `0` if the timeout was found and cancelled successfully,851/// The completion event result will be `0` if the timeout was found and canceled successfully,
852/// `-EBUSY` if the timeout was found but expiration was already in progress, or852/// `-EBUSY` if the timeout was found but expiration was already in progress, or
853/// `-ENOENT` if the timeout was not found.853/// `-ENOENT` if the timeout was not found.
854pub fn timeout_remove(854pub fn timeout_remove(
...@@ -972,7 +972,7 @@ pub fn statx(...@@ -972,7 +972,7 @@ pub fn statx(
972///972///
973/// The operation is identified by its `user_data`.973/// The operation is identified by its `user_data`.
974///974///
975/// The completion event result will be `0` if the operation was found and cancelled successfully,975/// The completion event result will be `0` if the operation was found and canceled successfully,
976/// `-EALREADY` if the operation was found but was already in progress, or976/// `-EALREADY` if the operation was found but was already in progress, or
977/// `-ENOENT` if the operation was not found.977/// `-ENOENT` if the operation was not found.
978pub fn cancel(978pub fn cancel(
lib/std/os/windows.zig+4-4
...@@ -522,7 +522,7 @@ pub fn PostQueuedCompletionStatus(...@@ -522,7 +522,7 @@ pub fn PostQueuedCompletionStatus(
522pub const GetQueuedCompletionStatusResult = enum {522pub const GetQueuedCompletionStatusResult = enum {
523 Normal,523 Normal,
524 Aborted,524 Aborted,
525 Cancelled,525 Canceled,
526 EOF,526 EOF,
527 Timeout,527 Timeout,
528};528};
...@@ -543,7 +543,7 @@ pub fn GetQueuedCompletionStatus(...@@ -543,7 +543,7 @@ pub fn GetQueuedCompletionStatus(
543 ) == FALSE) {543 ) == FALSE) {
544 switch (GetLastError()) {544 switch (GetLastError()) {
545 .ABANDONED_WAIT_0 => return GetQueuedCompletionStatusResult.Aborted,545 .ABANDONED_WAIT_0 => return GetQueuedCompletionStatusResult.Aborted,
546 .OPERATION_ABORTED => return GetQueuedCompletionStatusResult.Cancelled,546 .OPERATION_ABORTED => return GetQueuedCompletionStatusResult.Canceled,
547 .HANDLE_EOF => return GetQueuedCompletionStatusResult.EOF,547 .HANDLE_EOF => return GetQueuedCompletionStatusResult.EOF,
548 .WAIT_TIMEOUT => return GetQueuedCompletionStatusResult.Timeout,548 .WAIT_TIMEOUT => return GetQueuedCompletionStatusResult.Timeout,
549 else => |err| {549 else => |err| {
...@@ -559,7 +559,7 @@ pub fn GetQueuedCompletionStatus(...@@ -559,7 +559,7 @@ pub fn GetQueuedCompletionStatus(
559559
560pub const GetQueuedCompletionStatusError = error{560pub const GetQueuedCompletionStatusError = error{
561 Aborted,561 Aborted,
562 Cancelled,562 Canceled,
563 EOF,563 EOF,
564 Timeout,564 Timeout,
565} || UnexpectedError;565} || UnexpectedError;
...@@ -584,7 +584,7 @@ pub fn GetQueuedCompletionStatusEx(...@@ -584,7 +584,7 @@ pub fn GetQueuedCompletionStatusEx(
584 if (success == FALSE) {584 if (success == FALSE) {
585 return switch (GetLastError()) {585 return switch (GetLastError()) {
586 .ABANDONED_WAIT_0 => error.Aborted,586 .ABANDONED_WAIT_0 => error.Aborted,
587 .OPERATION_ABORTED => error.Cancelled,587 .OPERATION_ABORTED => error.Canceled,
588 .HANDLE_EOF => error.EOF,588 .HANDLE_EOF => error.EOF,
589 .WAIT_TIMEOUT => error.Timeout,589 .WAIT_TIMEOUT => error.Timeout,
590 else => |err| unexpectedError(err),590 else => |err| unexpectedError(err),
lib/std/os/windows/win32error.zig+1-1
...@@ -624,7 +624,7 @@ pub const Win32Error = enum(u16) {...@@ -624,7 +624,7 @@ pub const Win32Error = enum(u16) {
624 DATA_NOT_ACCEPTED = 592,624 DATA_NOT_ACCEPTED = 592,
625 /// NTVDM encountered a hard error.625 /// NTVDM encountered a hard error.
626 VDM_HARD_ERROR = 593,626 VDM_HARD_ERROR = 593,
627 /// {Cancel Timeout} The driver %hs failed to complete a cancelled I/O request in the allotted time.627 /// {Cancel Timeout} The driver %hs failed to complete a canceled I/O request in the allotted time.
628 DRIVER_CANCEL_TIMEOUT = 594,628 DRIVER_CANCEL_TIMEOUT = 594,
629 /// {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.629 /// {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.
630 REPLY_MESSAGE_MISMATCH = 595,630 REPLY_MESSAGE_MISMATCH = 595,