On 10/9/13 4:30 AM, Jacob Carlborg wrote:
On 2013-10-09 05:31, Walter Bright wrote:

Making this work is fraught with difficulty. It is normal behavior in D
to create local data with new(), build a data structure, and then cast
it to shared so it can be transferred to another thread. This will fail
miserably if the data is allocated on a thread local heap.

I agree with Andrei here. Alternatively perhaps the runtime can move the
data to a global pool if it's casted to shared.

I think a reasonable solution (in case we're unable to solve this reasonably within the type system) is to offer a library solution that does the shared allocation, mutation, and casting internally.

Again: USER CODE SHOULD HAVE NO BUSINESS CASTING CASUALLY TO GET WORK DONE.


Andrei

Reply via email to