Am Thu, 10 Oct 2013 22:04:16 -0400 schrieb "Jonathan M Davis" <jmdavisp...@gmx.com>:
> most D programmers seem to describe when talking about shared is > simply using __gshared with normal types, not even using shared, let > alone using it with types specifically designed to function as > shared. So, the most common approach at this point in D seems to be > to avoid shared entirely. One important reason for this is that the types in core.sync still aren't shared. -------- Mutex myMutex; //WRONG, myMutex is in TLS shared Mutex myMutex; //WRONG, can't call .lock, new __gshared Mutex myMutex; //Can't be used in @safe code... //shared Mutex + casting to unshared when accessing: Can't be used in //@safe code See also: http://forum.dlang.org/thread/mailman.2017.1353214033.5162.digitalmar...@puremagic.com?page=2#post-mailman.2037.1353278884.5162.digitalmars-d:40puremagic.com Sean Kelly: "I tried this once and it cascaded to requiring modifications of various definitions on core.sys.posix to add a "shared" qualifier, and since I wasn't ready to do that I rolled back the changes. I guess the alternative would be to have a shared equivalent for every operation that basically just casts away shared and then calls the non-shared function, but that's such a terrible design I've been resisting it."