> Use channels, not pointers

This isn't about feeding incoming data to threads. I agree that new data that 
is relevant for mutlithreading should be passed via channels. But this is for 
example about general cfg that is read from a file before any thread starts and 
which doesn't change - or actually the channel itself as ptr. Even the 
[doc](https://nim-lang.org/docs/channels_builtin.html) recommends to pass 
Channels as ptr to share them between threads. `Channels cannot be passed 
between threads. Use globals or pass them by ptr`

> Use channels + ref object or atomic refcounting not ARC

So - you are telling me to not use arc when using threads? I thought that arc 
could become the next default gc.

Would it make sense to create some ref counted datatype that can be shared more 
easily in threads, similar to shared_ptr in c++? Not sure if this is a good 
idea, as even shared_ptr in c++ have their traps that require to use 
atomic_shared_ptrs in some situations. Just thinking out loud. 

Reply via email to