mirror of
https://github.com/logos-storage/nim-datastore.git
synced 2026-01-07 16:13:07 +00:00
fix compilation
This commit is contained in:
parent
0b5534f3f9
commit
609976ce86
@ -32,7 +32,7 @@ proc decr*[T](x: var SharedPtr[T]) =
|
|||||||
if x.val != nil and x.cnt != nil:
|
if x.val != nil and x.cnt != nil:
|
||||||
let res = atomicSubFetch(x.cnt, 1, ATOMIC_ACQUIRE)
|
let res = atomicSubFetch(x.cnt, 1, ATOMIC_ACQUIRE)
|
||||||
if res == 0:
|
if res == 0:
|
||||||
echo "SharedPtr: FREE: ", repr x.val.pointer, " ", x[].cnt[], " tp: ", $(typeof(T))
|
echo "SharedPtr: FREE: ", repr x.val.pointer, " ", x.cnt[], " tp: ", $(typeof(T))
|
||||||
when compiles(`=destroy`(x.val)):
|
when compiles(`=destroy`(x.val)):
|
||||||
echo "DECR FREE"
|
echo "DECR FREE"
|
||||||
`=destroy`(x.val)
|
`=destroy`(x.val)
|
||||||
@ -100,4 +100,4 @@ template `[]=`*[T](p: SharedPtr[T]; val: T) =
|
|||||||
|
|
||||||
proc `$`*[T](p: SharedPtr[T]): string {.inline.} =
|
proc `$`*[T](p: SharedPtr[T]): string {.inline.} =
|
||||||
if p.val == nil: "nil"
|
if p.val == nil: "nil"
|
||||||
else: "(val: " & $p.val.value & ")"
|
else: "(val: " & $p.val[] & ")"
|
||||||
|
|||||||
@ -8,7 +8,7 @@ import pkg/unittest2
|
|||||||
import pkg/questionable
|
import pkg/questionable
|
||||||
import pkg/questionable/results
|
import pkg/questionable/results
|
||||||
|
|
||||||
include ../../datastore/databuffer
|
include pkg/datastore/threads/databuffer
|
||||||
|
|
||||||
var
|
var
|
||||||
shareVal: DataBuffer
|
shareVal: DataBuffer
|
||||||
@ -26,8 +26,8 @@ proc thread1(val: int) {.thread.} =
|
|||||||
var myBytes = DataBuffer.new(@"hello world")
|
var myBytes = DataBuffer.new(@"hello world")
|
||||||
myBytes2 = myBytes
|
myBytes2 = myBytes
|
||||||
|
|
||||||
echo "thread1: sending: ", myBytes
|
echo "thread1: sending: ", $myBytes
|
||||||
echo "mybytes2: ", myBytes2
|
echo "mybytes2: ", $myBytes2
|
||||||
|
|
||||||
shareVal = myBytes
|
shareVal = myBytes
|
||||||
echo "thread1: sent, left over: ", $myBytes
|
echo "thread1: sent, left over: ", $myBytes
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user