mirror of
https://github.com/logos-storage/nim-datastore.git
synced 2026-01-03 22:23:10 +00:00
cleanup
This commit is contained in:
parent
76ec7e7f16
commit
2c881d9eef
@ -1,4 +1,3 @@
|
||||
# import std/atomics
|
||||
import threading/smartptrs
|
||||
import std/hashes
|
||||
|
||||
|
||||
@ -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
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user