Is there any way to mark all objects __gshared
with DMD? I am working on a game engine where pretty much everything needs to be shared between threads, and spamming __gshared
or shared
everywhere doesn't cut it.
For everyone wanting me not to do this: Critical sections will be minimal and reduced to checking if an enum is set to Loaded or not (mutexed of course). So concurrency won't gain me anything.
you can put all the variables in a block and declare that shared
__gshared{
SharedClass instance;
//...
}
also note that all fields in a shared class or struct are shared
I should however note that this inconvenience is by design and an encouragement to restructure your data to minimize the shared stuff