mirror of
https://github.com/logos-storage/nim-datastore.git
synced 2026-01-03 06:03:06 +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:
|
||||
let res = atomicSubFetch(x.cnt, 1, ATOMIC_ACQUIRE)
|
||||
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)):
|
||||
echo "DECR FREE"
|
||||
`=destroy`(x.val)
|
||||
@ -100,4 +100,4 @@ template `[]=`*[T](p: SharedPtr[T]; val: T) =
|
||||
|
||||
proc `$`*[T](p: SharedPtr[T]): string {.inline.} =
|
||||
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/results
|
||||
|
||||
include ../../datastore/databuffer
|
||||
include pkg/datastore/threads/databuffer
|
||||
|
||||
var
|
||||
shareVal: DataBuffer
|
||||
@ -26,8 +26,8 @@ proc thread1(val: int) {.thread.} =
|
||||
var myBytes = DataBuffer.new(@"hello world")
|
||||
myBytes2 = myBytes
|
||||
|
||||
echo "thread1: sending: ", myBytes
|
||||
echo "mybytes2: ", myBytes2
|
||||
echo "thread1: sending: ", $myBytes
|
||||
echo "mybytes2: ", $myBytes2
|
||||
|
||||
shareVal = myBytes
|
||||
echo "thread1: sent, left over: ", $myBytes
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user