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 #807 from Safety0ff/gciterlock
Browse files Browse the repository at this point in the history
Fix locking in GC.rootIter and GC.rangeIter
  • Loading branch information
MartinNowak committed May 24, 2014
2 parents f16c71d + 426b7a0 commit 2bec03c
Showing 1 changed file with 16 additions and 8 deletions.
24 changes: 16 additions & 8 deletions src/gc/gc.d
Expand Up @@ -1097,10 +1097,14 @@ class GC
*/
@property auto rootIter()
{
gcLock.lock();
auto rc = &gcx.roots.opApply;
gcLock.unlock();
return rc;
auto iter(scope int delegate(ref Root) nothrow dg)
{
gcLock.lock();
auto res = gcx.roots.opApply(dg);
gcLock.unlock();
return res;
}
return &iter;
}


Expand Down Expand Up @@ -1154,10 +1158,14 @@ class GC
*/
@property auto rangeIter()
{
gcLock.lock();
auto rc = &gcx.ranges.opApply;
gcLock.unlock();
return rc;
auto iter(scope int delegate(ref Range) nothrow dg)
{
gcLock.lock();
auto res = gcx.ranges.opApply(dg);
gcLock.unlock();
return res;
}
return &iter;
}


Expand Down

0 comments on commit 2bec03c

Please sign in to comment.