On Saturday, 30 November 2013 at 11:33:06 UTC, Iain Buclaw wrote:
On Nov 30, 2013 9:30 AM, "bearophile"
<[email protected]> wrote:
The point of annotations like @nogc or @noheap is not to
disable the GC,
but to statically disallow its usage transitively inside a
function.
Ok, but what you describe is a different meaning to "no
unexpected
activity from the GC in critical sections". I'll have to double
check, but
do we still have a sort of global lock system in the GC for
handling
multiple threads?
Regards
Ah, yes. When we have multiple threads running @nogc won't
guarantee "no unexpected activity" alone, that is true. It can
however, be combined with the non-suspendable threads feature
that was proposed a few months ago here:
https://github.com/D-Programming-Language/druntime/pull/493
I would think it would be possible to force a non-suspendable
thread to accept only a @nogc function as an entry point, too, if
the thread's suspendability is fixed at creation.
These two enhancements plus DIP46 would together give D
programmers some serious freedom with respect to working with the
GC. Not only would it greatly simplify GC-free programming, but
it would allow for (trustworthy) hybrid GC/manual memory
management for applications which need to have total control over
only specific sections of code or specific threads.