How to move variable to other thread

2022-12-23 Thread c4UlMu
Yep, Thank you. This is what I was looking for

How to move variable to other thread

2022-12-23 Thread Hlaaftana
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

How to move variable to other thread

2022-12-23 Thread archnim
What do you mean when you say "move" ?

How to move variable to other thread

2022-12-23 Thread c4UlMu
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()