mirror of
https://codeberg.org/ziglang/zig.git
synced 2025-12-06 05:44:20 +00:00
Merge pull request #25763 from mrjbq7/cancelled
rename Cancelled to Canceled
This commit is contained in:
parent
1d80c9540a
commit
74c23a237e
6 changed files with 17 additions and 17 deletions
|
|
@ -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,
|
||||
};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
};
|
||||
|
|
|
|||
|
|
@ -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(
|
||||
|
|
|
|||
|
|
@ -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),
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue