Yep, Thank you. This is what I was looking for
These were tested on 1.6.0, unsure if the same will work on later versions.
The global context makes it so the destruction of `myStr` is delayed until
program exit and `var theStr = ..` makes a copy instead. Wrapping it in a proc
gives the result you expect.
import locks
type
What do you mean when you say "move" ?
I want to move custom object to a thread (without channels by hand) I wrote
this code
import locks
type
MyString = object
val: string
var L: Lock
proc `=destroy`(myStr: var MyString) =
echo "Destroy '", myStr, "' ", getThreadId()