summary refs log tree commit diff stats
path: root/lib/system
diff options
context:
space:
mode:
Diffstat (limited to 'lib/system')
-rw-r--r--lib/system/channels.nim46
-rw-r--r--lib/system/syslocks.nim2
-rw-r--r--lib/system/threads.nim8
3 files changed, 28 insertions, 28 deletions
diff --git a/lib/system/channels.nim b/lib/system/channels.nim
index 0715d05e5..b3ff61b88 100644
--- a/lib/system/channels.nim
+++ b/lib/system/channels.nim
@@ -13,9 +13,9 @@
 ##

 ## **Note:** The current implementation of message passing is slow and does

 ## not work with cyclic data structures.

-  
-when not declared(NimString):
-  {.error: "You must not import this module explicitly".}
+  

+when not declared(NimString):

+  {.error: "You must not import this module explicitly".}

 

 type

   pbytes = ptr array[0.. 0xffff, byte]

@@ -73,11 +73,11 @@ proc storeAux(dest, src: pointer, mt: PNimType, t: PRawChannel,
     d = cast[TAddress](dest)

     s = cast[TAddress](src)

   sysAssert(mt != nil, "mt == nil")

-  case mt.Kind

+  case mt.kind

   of tyString:

     if mode == mStore:

-      var x = cast[ppointer](dest)

-      var s2 = cast[ppointer](s)[]

+      var x = cast[PPointer](dest)

+      var s2 = cast[PPointer](s)[]

       if s2 == nil: 

         x[] = nil

       else:

@@ -86,17 +86,17 @@ proc storeAux(dest, src: pointer, mt: PNimType, t: PRawChannel,
         copyMem(ns, ss, ss.len+1 + GenericSeqSize)

         x[] = ns

     else:

-      var x = cast[ppointer](dest)

-      var s2 = cast[ppointer](s)[]

+      var x = cast[PPointer](dest)

+      var s2 = cast[PPointer](s)[]

       if s2 == nil:

         unsureAsgnRef(x, s2)

       else:

         unsureAsgnRef(x, copyString(cast[NimString](s2)))

         dealloc(t.region, s2)

   of tySequence:

-    var s2 = cast[ppointer](src)[]

+    var s2 = cast[PPointer](src)[]

     var seq = cast[PGenericSeq](s2)

-    var x = cast[ppointer](dest)

+    var x = cast[PPointer](dest)

     if s2 == nil:

       if mode == mStore:

         x[] = nil

@@ -108,13 +108,13 @@ proc storeAux(dest, src: pointer, mt: PNimType, t: PRawChannel,
         x[] = alloc(t.region, seq.len *% mt.base.size +% GenericSeqSize)

       else:

         unsureAsgnRef(x, newObj(mt, seq.len * mt.base.size + GenericSeqSize))

-      var dst = cast[taddress](cast[ppointer](dest)[])

+      var dst = cast[TAddress](cast[PPointer](dest)[])

       for i in 0..seq.len-1:

         storeAux(

           cast[pointer](dst +% i*% mt.base.size +% GenericSeqSize),

           cast[pointer](cast[TAddress](s2) +% i *% mt.base.size +%

                         GenericSeqSize),

-          mt.Base, t, mode)

+          mt.base, t, mode)

       var dstseq = cast[PGenericSeq](dst)

       dstseq.len = seq.len

       dstseq.reserved = seq.len

@@ -123,8 +123,8 @@ proc storeAux(dest, src: pointer, mt: PNimType, t: PRawChannel,
     # copy type field:

     var pint = cast[ptr PNimType](dest)

     # XXX use dynamic type here!

-    pint[] = mt
-    if mt.base != nil:
+    pint[] = mt

+    if mt.base != nil:

       storeAux(dest, src, mt.base, t, mode)

     storeAux(dest, src, mt.node, t, mode)

   of tyTuple:

@@ -134,8 +134,8 @@ proc storeAux(dest, src: pointer, mt: PNimType, t: PRawChannel,
       storeAux(cast[pointer](d +% i*% mt.base.size),

                cast[pointer](s +% i*% mt.base.size), mt.base, t, mode)

   of tyRef:

-    var s = cast[ppointer](src)[]

-    var x = cast[ppointer](dest)

+    var s = cast[PPointer](src)[]

+    var x = cast[PPointer](dest)

     if s == nil:

       if mode == mStore:

         x[] = nil

@@ -225,20 +225,20 @@ proc recv*[TMsg](c: var TChannel[TMsg]): TMsg =
   acquireSys(q.lock)

   llRecv(q, addr(result), cast[PNimType](getTypeInfo(result)))

   releaseSys(q.lock)

-
-proc tryRecv*[TMsg](c: var TChannel[TMsg]): tuple[dataAvaliable: bool,
-                                                  msg: TMsg] =
-  ## try to receives a message from the channel `c` if available. Otherwise
-  ## it returns ``(false, default(msg))``.
+

+proc tryRecv*[TMsg](c: var TChannel[TMsg]): tuple[dataAvaliable: bool,

+                                                  msg: TMsg] =

+  ## try to receives a message from the channel `c` if available. Otherwise

+  ## it returns ``(false, default(msg))``.

   var q = cast[PRawChannel](addr(c))

   if q.mask != ChannelDeadMask:

     lockChannel(q):

-      llRecv(q, addr(result.msg), cast[PNimType](getTypeInfo(result.msg)))
+      llRecv(q, addr(result.msg), cast[PNimType](getTypeInfo(result.msg)))

       result.dataAvaliable = true

 

 proc peek*[TMsg](c: var TChannel[TMsg]): int =

   ## returns the current number of messages in the channel `c`. Returns -1

-  ## if the channel has been closed. **Note**: This is dangerous to use
+  ## if the channel has been closed. **Note**: This is dangerous to use

   ## as it encourages races. It's much better to use ``tryRecv`` instead.

   var q = cast[PRawChannel](addr(c))

   if q.mask != ChannelDeadMask:

diff --git a/lib/system/syslocks.nim b/lib/system/syslocks.nim
index cff873cf4..8b38f34f3 100644
--- a/lib/system/syslocks.nim
+++ b/lib/system/syslocks.nim
@@ -31,7 +31,7 @@ when defined(Windows):
     ## Tries to acquire the lock `L`.
     
   proc tryAcquireSys(L: var TSysLock): bool {.inline.} = 
-    result = TryAcquireSysAux(L) != 0'i32
+    result = tryAcquireSysAux(L) != 0'i32
 
   proc acquireSys(L: var TSysLock) {.stdcall, noSideEffect,
     dynlib: "kernel32", importc: "EnterCriticalSection".}
diff --git a/lib/system/threads.nim b/lib/system/threads.nim
index 9e945544f..6057b7749 100644
--- a/lib/system/threads.nim
+++ b/lib/system/threads.nim
@@ -190,7 +190,7 @@ var globalsSlot = threadVarAlloc()
 
 when emulatedThreadVars:
   proc GetThreadLocalVars(): pointer {.compilerRtl, inl.} =
-    result = addr(cast[PGcThread](ThreadVarGetValue(globalsSlot)).tls)
+    result = addr(cast[PGcThread](threadVarGetValue(globalsSlot)).tls)
 
 when useStackMaskHack:
   proc maskStackPointer(offset: int): pointer {.compilerRtl, inl.} =
@@ -210,7 +210,7 @@ when not defined(useNimRtl):
     initGC()
     
   when emulatedThreadVars:
-    if NimThreadVarsSize() > sizeof(TThreadLocalStorage):
+    if nimThreadVarsSize() > sizeof(TThreadLocalStorage):
       echo "too large thread local storage size requested"
       quit 1
   
@@ -267,7 +267,7 @@ when not defined(boehmgc) and not hasSharedHeap:
   proc deallocOsPages()
 
 template threadProcWrapperBody(closure: expr) {.immediate.} =
-  when declared(globalsSlot): ThreadVarSetValue(globalsSlot, closure)
+  when declared(globalsSlot): threadVarSetValue(globalsSlot, closure)
   var t = cast[ptr TThread[TArg]](closure)
   when useStackMaskHack:
     var tls: TThreadLocalStorage
@@ -364,7 +364,7 @@ proc threadId*[TArg](t: var TThread[TArg]): TThreadId[TArg] {.inline.} =
 proc myThreadId*[TArg](): TThreadId[TArg] =
   ## returns the thread ID of the thread that calls this proc. This is unsafe
   ## because the type ``TArg`` is not checked for consistency!
-  result = cast[TThreadId[TArg]](ThreadVarGetValue(globalsSlot))
+  result = cast[TThreadId[TArg]](threadVarGetValue(globalsSlot))
 
 when false:
   proc mainThreadId*[TArg](): TThreadId[TArg] =