diff options
| author | John Benediktsson <mrjbq7@gmail.com> | 2025-10-29 21:40:13 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-10-30 04:40:13 +0000 |
| commit | 74c23a237ef5245b63eb06b832a511aabeb715c0 (patch) | |
| tree | 761a4a85b78662a83078a18f1a49973c22854ed0 /lib/std/Thread | |
| parent | 1d80c9540af9b3c577c8cca740247b968e7e59f1 (diff) | |
| download | zig-74c23a237ef5245b63eb06b832a511aabeb715c0.tar.gz zig-74c23a237ef5245b63eb06b832a511aabeb715c0.zip | |
Merge pull request #25763 from mrjbq7/cancelled
rename Cancelled to Canceled
Diffstat (limited to 'lib/std/Thread')
| -rw-r--r-- | lib/std/Thread/Futex.zig | 16 |
1 files changed, 8 insertions, 8 deletions
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; } }; |
