www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - Node.js async/threads and shared in D

I have a Node.js module written in D and exposed through C++ 
interface. I'd like to implement a proper async API which is 
pretty straightforward using libuv in the C++ glue part. On the D 
side I have a data structure that's build once and then queried 
from Node (possibly torn down and rebuild later). Since it will 
be queried asynchronously, it will be called from multiple 
threads. It is build using and stores inside a bunch of helper 
classes. Am I correct to assume that for this data structure to 
be available across threads it and every class it touches have to 
be marked shared? What about types that I have no control of, 
like arrays? Are they inherently shared?

I did read "Lock-Free Coding with shared classes" from TDPL, but 
it has a rather short example and the structure there is both 
read and written from multiple threads.

Thanks for any pointers.
Jun 11 2014