Araq's recent post "A cost model for Nim" states that "Memory can be shared 
effectively between threads without copying in Nim version 2".

This is related to a problem I have been struggling with for a long time.

Basically, the problem is this:

  * I have a program with two threads, A and B.
  * Thread A creates a ref object and of course owns this ref.
  * Thread A somehow moves this to thread B. (here lies the problem: how?)
  * Thread A no longer has any references to the object, an it is now 
effectively owned by thread B.



My question is: how can this be done in Nim (or Nim 2), without violating the 
underlying C memory model?

I can proved more technical details about approaches I have tried and what the 
problems are I run into, but maybe there just is a very simple and obvious 
solution I do not know about.

Reply via email to