DIP60: @nogc attribute

via Digitalmars-d digitalmars-d at puremagic.com
Tue Apr 22 07:33:19 PDT 2014


On Tuesday, 22 April 2014 at 14:07:47 UTC, Steven Schveighoffer 
wrote:
>> know this you are required to know the internals of the 
>> framework you are utilizing or inject runtime guards into your 
>> D functions?
>
> Or just mark those objects sent into the framework as shared. 
> Having multi-threaded RC isn't bad, just not as efficient.

Actually, when I think of it, guards probably would be cheap. All 
you have to do is to store the thread-context-pointer-register 
into a global when the thread starts up. Then just do a simple 
if-test at the function invocation. (assuming the register 
doesn't change over time).

Actually, it could be done as a self-modifying pass at startup… 
That would make it a register test against an immediate value, no 
memory buss implications.

> One thing that would be nice is to allow moving a data pointer 
> from one thread to another. In other words, as long as your 
> data is contained, it can pass from one thread to another, and 
> still be considered unshared.

Yes, that sounds plausible.

> I think this is what you are talking about above, or is there 
> something else?

You are right :).

Ola.


More information about the Digitalmars-d mailing list