This commit is contained in:
Jaremy Creechley 2023-08-29 17:13:13 -07:00 committed by Dmitriy Ryajov
parent 76ec7e7f16
commit 2c881d9eef
No known key found for this signature in database
GPG Key ID: DA8C680CE7C657A4
2 changed files with 0 additions and 18 deletions

View File

@ -1,4 +1,3 @@
# import std/atomics
import threading/smartptrs
import std/hashes

View File

@ -10,23 +10,6 @@ import pkg/questionable/results
include ../../datastore/databuffer
type
AtomicFreed* = ptr int
proc newFreedValue*(val = 0): ptr int =
result = cast[ptr int](alloc0(sizeof(int)))
result[] = val
proc getFreedValue*(x: ptr int): int =
atomicLoad(x, addr result, ATOMIC_ACQUIRE)
proc incrFreedValue*(x: ptr int): int =
atomicAddFetch(x, 1, ATOMIC_ACQUIRE)
proc decrFreedValue*(x: ptr int): int =
atomicSubFetch(x, 1, ATOMIC_ACQUIRE)
var
shareVal: DataBuffer
lock: Lock