News for hackers. Stuff that matters.
Re:Rust: Dropping heavy things in another thread can make yo... by kevincox on Saturday May 30, 2020 @04:19PM (#23364304)
Semantically it is a bitwise copy.

In the example from the article it is probably actually a copy because the value was originally on the parent thread's stack, which will be reused after the function returns, so the value will need to be copied to the new thread's stack.

However it is important to not that it isn't a deep/recursive bitwise copy. It just needs to copy the HashMap itself (which is probably a handful of words).

So yes, it is doing a bitwise copy, but this is also very cheap. It will be much, much cheaper than spawning the thread.

There are no comments on this comment yet.