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

Commit

Permalink
Merge pull request #1092 from aG0aep6G/@nogc-rootIter-and-rangeIter
Browse files Browse the repository at this point in the history
@nogc rootIter and rangeIter
  • Loading branch information
andralex committed Jan 9, 2015
2 parents 0803287 + 9197767 commit a0c35e1
Showing 1 changed file with 22 additions and 14 deletions.
36 changes: 22 additions & 14 deletions src/gc/gc.d
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 a0c35e1

Please sign in to comment.