This commit is contained in:
Jaremy Creechley 2023-08-29 17:13:13 -07:00
parent 1594977abf
commit 5b5c262068
No known key found for this signature in database
GPG Key ID: 4E66FB67B21D3300
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