Showing with 22 additions and 14 deletions.
  1. +22 −14 src/gc/gc.d
36 changes: 22 additions & 14 deletions src/gc/gc.d
Original file line number Diff line number Diff line change
Expand Up @@ -1099,16 +1099,20 @@ class GC
/**
*
*/
@property auto rootIter()
@property auto rootIter() @nogc
{
auto iter(scope int delegate(ref Root) nothrow dg)
static struct Iter
{
gcLock.lock();
auto res = gcx.roots.opApply(dg);
gcLock.unlock();
return res;
private GC gc;
auto opApply(scope int delegate(ref Root) nothrow dg)
{
gc.gcLock.lock();
auto res = gc.gcx.roots.opApply(dg);
gc.gcLock.unlock();
return res;
}
}
return &iter;
return Iter(this);
}


Expand Down Expand Up @@ -1160,16 +1164,20 @@ class GC
/**
*
*/
@property auto rangeIter()
@property auto rangeIter() @nogc
{
auto iter(scope int delegate(ref Range) nothrow dg)
static struct Iter
{
gcLock.lock();
auto res = gcx.ranges.opApply(dg);
gcLock.unlock();
return res;
private GC gc;
auto opApply(scope int delegate(ref Range) nothrow dg)
{
gc.gcLock.lock();
auto res = gc.gcx.ranges.opApply(dg);
gc.gcLock.unlock();
return res;
}
}
return &iter;
return Iter(this);
}


Expand Down