summary refs log tree commit diff stats
path: root/lib/system/gc.nim
diff options
context:
space:
mode:
authorAraq <rumpf_a@web.de>2010-11-18 22:56:09 +0100
committerAraq <rumpf_a@web.de>2010-11-18 22:56:09 +0100
commitee445dc02297802136b5005408f6807820864c7f (patch)
tree5d1f1951fa077d0a36cbb0fd52e4a375ab6970b5 /lib/system/gc.nim
parentadf13aaea379d482ad4289d349a9d475bc2c06a6 (diff)
downloadNim-ee445dc02297802136b5005408f6807820864c7f.tar.gz
renamed lock->aquire
Diffstat (limited to 'lib/system/gc.nim')
-rwxr-xr-xlib/system/gc.nim32
1 files changed, 16 insertions, 16 deletions
diff --git a/lib/system/gc.nim b/lib/system/gc.nim
index aca3705cd..72ae84096 100755
--- a/lib/system/gc.nim
+++ b/lib/system/gc.nim
@@ -76,17 +76,17 @@ var
     # This is wasteful but safe. This is a lock against recursive garbage
     # collection, not a lock for threads!
 
-proc lock(gch: var TGcHeap) {.inline.} = 
+proc aquire(gch: var TGcHeap) {.inline.} = 
   when hasThreadSupport:
     if isMultiThreaded: 
-      Lock(gch.zctLock)
-      lock(gch.cycleRootsLock)
+      aquire(gch.zctLock)
+      aquire(gch.cycleRootsLock)
 
-proc unlock(gch: var TGcHeap) {.inline.} = 
+proc release(gch: var TGcHeap) {.inline.} = 
   when hasThreadSupport:
     if isMultiThreaded: 
-      unlock(gch.zctLock)
-      unlock(gch.cycleRootsLock)
+      release(gch.zctLock)
+      release(gch.cycleRootsLock)
 
 proc addZCT(s: var TCellSeq, c: PCell) {.noinline.} =
   if (c.refcount and rcZct) == 0:
@@ -205,18 +205,18 @@ proc prepareDealloc(cell: PCell) =
 proc rtlAddCycleRoot(c: PCell) {.rtl, inl.} = 
   # we MUST access gch as a global here, because this crosses DLL boundaries!
   when hasThreadSupport:
-    if isMultiThreaded: Lock(gch.cycleRootsLock)
+    if isMultiThreaded: Aquire(gch.cycleRootsLock)
   incl(gch.cycleRoots, c)
   when hasThreadSupport:  
-    if isMultiThreaded: Unlock(gch.cycleRootsLock)
+    if isMultiThreaded: Release(gch.cycleRootsLock)
 
 proc rtlAddZCT(c: PCell) {.rtl, inl.} =
   # we MUST access gch as a global here, because this crosses DLL boundaries!
   when hasThreadSupport:
-    if isMultiThreaded: Lock(gch.zctLock)
+    if isMultiThreaded: Aquire(gch.zctLock)
   addZCT(gch.zct, c)
   when hasThreadSupport:
-    if isMultiThreaded: Unlock(gch.zctLock)
+    if isMultiThreaded: Release(gch.zctLock)
 
 proc decRef(c: PCell) {.inline.} =
   when stressGC:
@@ -333,7 +333,7 @@ proc checkCollection {.inline.} =
 
 proc newObj(typ: PNimType, size: int): pointer {.compilerRtl.} =
   # generates a new object and sets its reference counter to 0
-  lock(gch)
+  aquire(gch)
   assert(typ.kind in {tyRef, tyString, tySequence})
   checkCollection()
   var res = cast[PCell](rawAlloc(allocator, size + sizeof(TCell)))
@@ -362,7 +362,7 @@ proc newObj(typ: PNimType, size: int): pointer {.compilerRtl.} =
     add(gch.zct, res)
   when logGC: writeCell("new cell", res)
   gcTrace(res, csAllocated)  
-  unlock(gch)
+  release(gch)
   result = cellToUsr(res)
 
 proc newSeq(typ: PNimType, len: int): pointer {.compilerRtl.} =
@@ -372,7 +372,7 @@ proc newSeq(typ: PNimType, len: int): pointer {.compilerRtl.} =
   cast[PGenericSeq](result).space = len
 
 proc growObj(old: pointer, newsize: int): pointer {.rtl.} =
-  lock(gch)
+  aquire(gch)
   checkCollection()
   var ol = usrToCell(old)
   assert(ol.typ != nil)
@@ -410,7 +410,7 @@ proc growObj(old: pointer, newsize: int): pointer {.rtl.} =
   else:
     assert(ol.typ != nil)
     zeroMem(ol, sizeof(TCell))
-  unlock(gch)
+  release(gch)
   result = cellToUsr(res)
 
 # ---------------- cycle collector -------------------------------------------
@@ -679,12 +679,12 @@ when not defined(useNimRtl):
     # set to the max value to suppress the cycle detector
 
   proc GC_fullCollect() =
-    lock(gch)
+    aquire(gch)
     var oldThreshold = cycleThreshold
     cycleThreshold = 0 # forces cycle collection
     collectCT(gch)
     cycleThreshold = oldThreshold
-    unlock(gch)
+    release(gch)
 
   proc GC_getStatistics(): string =
     GC_disable()