summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorringabout <43030857+ringabout@users.noreply.github.com>2023-10-04 22:00:41 +0800
committerGitHub <noreply@github.com>2023-10-04 16:00:41 +0200
commitf4a623dadf1a5ba287dbb55893ab70d1d6638c3f (patch)
tree1e9d95ff5b3ed7f431108dac4cb17bd5150a6aa2
parent1a6ca0c6047ac1f1489f2b45e4966ddca1f40e46 (diff)
downloadNim-f4a623dadf1a5ba287dbb55893ab70d1d6638c3f.tar.gz
document `atomicInc` and `atomicDec` (#22789)
-rw-r--r--lib/std/sysatomics.nim2
1 files changed, 2 insertions, 0 deletions
diff --git a/lib/std/sysatomics.nim b/lib/std/sysatomics.nim
index 36a4e5537..d2f7f59eb 100644
--- a/lib/std/sysatomics.nim
+++ b/lib/std/sysatomics.nim
@@ -265,6 +265,7 @@ else:
 
 
 proc atomicInc*(memLoc: var int, x: int = 1): int {.inline, discardable, raises: [], tags: [].} =
+  ## Atomically increments the integer by some `x`. It returns the new value.
   when someGcc and hasThreadSupport:
     result = atomicAddFetch(memLoc.addr, x, ATOMIC_SEQ_CST)
   elif someVcc and hasThreadSupport:
@@ -275,6 +276,7 @@ proc atomicInc*(memLoc: var int, x: int = 1): int {.inline, discardable, raises:
     result = memLoc
 
 proc atomicDec*(memLoc: var int, x: int = 1): int {.inline, discardable, raises: [], tags: [].} =
+  ## Atomically decrements the integer by some `x`. It returns the new value.
   when someGcc and hasThreadSupport:
     when declared(atomicSubFetch):
       result = atomicSubFetch(memLoc.addr, x, ATOMIC_SEQ_CST)