3 ms·
It has always done that [1]. You can only send refs through channels or via the spawn primitive where they are serialized/deep copied (or as arguments to thread
by rbehrends 11y ago
It has always done that [1]. You can only send refs through channels or via the spawn primitive where they are serialized/deep copied (or as arguments to threads upon creation, where that happens implicitly).
[1] It may have been that using global variables to share refs between threads did only trigger a warning at some point, not an error. I'm not 100% sure about that. But the serialization has been there since the early days of multi-threading support in 2011.
- gokr 11y agoThank you for clearing that up - I have always been confused when pcwalton has written (a bunch of times) that "Nim's GC isn't thread safe" - since... I knew about the deep serialization and couldn't for my life understand why it wouldn't be safe then. But how could the segfaults then happen? Aha, you mean the test code perhaps shared via globals?