threadpool.nim: minor code style changes
This commit is contained in:
parent
ae358a0c7a
commit
ffe7b3a9bf
1 changed files with 5 additions and 5 deletions
|
|
@ -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.
|
||||||
##
|
##
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue