threadpool.nim: minor code style changes

This commit is contained in:
Araq 2020-07-18 21:40:44 +02:00
commit ffe7b3a9bf

View file

@ -321,15 +321,15 @@ var
currentPoolSize: int currentPoolSize: int
maxPoolSize = MaxThreadPoolSize maxPoolSize = MaxThreadPoolSize
minPoolSize = 4 minPoolSize = 4
gSomeReady : Semaphore gSomeReady: Semaphore
readyWorker: ptr Worker readyWorker: ptr Worker
# A workaround for recursion deadlock issue # A workaround for recursion deadlock issue
# https://github.com/nim-lang/Nim/issues/4597 # https://github.com/nim-lang/Nim/issues/4597
var var
numSlavesLock: Lock numSlavesLock: Lock
numSlavesRunning {.guard: numSlavesLock}: int numSlavesRunning {.guard: numSlavesLock.}: int
numSlavesWaiting {.guard: numSlavesLock}: int numSlavesWaiting {.guard: numSlavesLock.}: int
isSlave {.threadvar.}: bool isSlave {.threadvar.}: bool
numSlavesLock.initLock numSlavesLock.initLock
@ -464,7 +464,7 @@ proc pinnedSpawn*(id: ThreadId; call: sink typed): void {.magic: "Spawn".}
## ``call`` has to be proc call ``p(...)`` where ``p`` is gcsafe and has a ## ``call`` has to be proc call ``p(...)`` where ``p`` is gcsafe and has a
## return type that is either ``void`` or compatible with ``FlowVar[T]``. ## return type that is either ``void`` or compatible with ``FlowVar[T]``.
template spawnX*(call): void = template spawnX*(call) =
## Spawns a new task if a CPU core is ready, otherwise executes the ## Spawns a new task if a CPU core is ready, otherwise executes the
## call in the calling thread. ## call in the calling thread.
## ##