Regarding point no 2, I agree. It can be done currently by using _ptr_ or by 
switching gc, but some kind of mutex would be a nice addition to the standard 
library. Nim already has locks, but that requires passing both the lock and the 
object as _ptr_ , while ensuring that both the lock and the object are still 
alive until all processing is completed. There is a bit of plumbing there. Some 
convenient mutex would be a welcoming addition to the standard library.

I ended up implementing a my own version of C++'s _shared_ptr_ , with a few 
differences. It supports custom destructor (for cleaning up resources), acts as 
a read-write mutex, and can be safely moved and copied across threads. If 
anyone is interested in seeing the code, I will be more than happy to share. 
Maybe we can peer review the code since I am also new to Nim.

Reply via email to