Skip to content
This repository has been archived by the owner on Oct 12, 2022. It is now read-only.

Commit

Permalink
@nogc rootIter and rangeIter
Browse files Browse the repository at this point in the history
  • Loading branch information
aG0aep6G committed Jan 9, 2015
1 parent 0803287 commit 9197767
Showing 1 changed file with 22 additions and 14 deletions.
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

0 comments on commit 9197767

Please sign in to comment.