fix compilation

This commit is contained in:
Jaremy Creechley 2023-09-13 11:18:22 -07:00
parent 0b5534f3f9
commit 609976ce86
No known key found for this signature in database
GPG Key ID: 4E66FB67B21D3300
2 changed files with 5 additions and 5 deletions

View File

@ -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[] & ")"

View File

@ -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