DIP60: @nogc attribute

via Digitalmars-d digitalmars-d at puremagic.com
Thu Apr 17 23:16:27 PDT 2014


On Friday, 18 April 2014 at 00:11:28 UTC, H. S. Teoh via 
Digitalmars-d wrote:
> I thought that whole point of *A*RC is for the compiler to know 
> when ref
> count updates can be skipped? Or are you saying this is 
> algorithmically
> undecidable in the compiler?

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...?

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?




More information about the Digitalmars-d mailing list