From 8705f36dd1e5b0971d9bce5acbe92fff19674824 Mon Sep 17 00:00:00 2001 From: IntegratedQuantum Date: Tue, 24 Dec 2024 12:07:37 +0100 Subject: [PATCH] Fix documentation for @cmpxchg* functions. The text was incorrectly saying that it returns null in the failure path. --- doc/langref.html.in | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/doc/langref.html.in b/doc/langref.html.in index 87d73c987c52..35c1b35db2e6 100644 --- a/doc/langref.html.in +++ b/doc/langref.html.in @@ -4532,9 +4532,8 @@ comptime { {#header_open|@cmpxchgStrong#}
{#syntax#}@cmpxchgStrong(comptime T: type, ptr: *T, expected_value: T, new_value: T, success_order: AtomicOrder, fail_order: AtomicOrder) ?T{#endsyntax#}

- This function performs a strong atomic compare-and-exchange operation, returning {#syntax#}null{#endsyntax#} - if the current value is not the given expected value. It's the equivalent of this code, - except atomic: + This function performs a strong atomic compare-and-exchange operation, returning {#syntax#}null{#endsyntax#} on success. + It's the equivalent of this code, except atomic:

{#code|not_atomic_cmpxchgStrong.zig#} @@ -4554,9 +4553,8 @@ comptime { {#header_open|@cmpxchgWeak#}
{#syntax#}@cmpxchgWeak(comptime T: type, ptr: *T, expected_value: T, new_value: T, success_order: AtomicOrder, fail_order: AtomicOrder) ?T{#endsyntax#}

- This function performs a weak atomic compare-and-exchange operation, returning {#syntax#}null{#endsyntax#} - if the current value is not the given expected value. It's the equivalent of this code, - except atomic: + This function performs a weak atomic compare-and-exchange operation, returning {#syntax#}null{#endsyntax#} on success. + It's the equivalent of this code, except atomic:

{#syntax_block|zig|cmpxchgWeakButNotAtomic#} fn cmpxchgWeakButNotAtomic(comptime T: type, ptr: *T, expected_value: T, new_value: T) ?T {