<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On 18 April 2014 16:16, via Digitalmars-d <span dir="ltr"><<a href="mailto:digitalmars-d@puremagic.com" target="_blank">digitalmars-d@puremagic.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div class="">On Friday, 18 April 2014 at 00:11:28 UTC, H. S. Teoh via Digitalmars-d wrote:<br>

<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
I thought that whole point of *A*RC is for the compiler to know when ref<br>
count updates can be skipped? Or are you saying this is algorithmically<br>
undecidable in the compiler?<br>
</blockquote>
<br></div>
Multithreading cause major problems. A function owns the array passed as a parameter, no ref counting needed, but if another thread is deleting objects in the array then you cannot assume that ownership is transitive and will have to inc/dec every object you look at. If it is thread local then ownership is transitive and no inc/decs are needed in the function...?<br>

<br>
But how can you let the compiler know that you have protected the array so only one thread will take processing-ownership during the life span of the function call?<br></blockquote><div><br></div><div>D pointers are thread-local by default, you need to mark things 'shared' explicitly if they are to be passed between threads. This is one of the great advantages D has over C/C++/Obj-C.</div>
</div></div></div>