Something needs to happen with shared, and soon.

Jacob Carlborg doob at me.com
Tue Nov 13 23:37:07 PST 2012


On 2012-11-13 23:22, Walter Bright wrote:

> But I do see enormous value in shared in that it logically (and rather
> forcefully) separates thread-local code from multi-thread code. For
> example, see the post here about adding a destructor to a shared struct,
> and having it fail to compile. The complaint was along the lines of
> shared being broken, whereas I viewed it along the lines of shared
> pointing out a logic problem in the code - what does destroying a struct
> accessible from multiple threads mean? I think it must be clear that
> destroying an object can only happen in one thread, i.e. the object must
> become thread local in order to be destroyed.

If the compiler should/does not add memory barriers, then is there a 
reason for having it built into the language? Can a library solution be 
enough?

-- 
/Jacob Carlborg


More information about the Digitalmars-d mailing list