diff options
author | Araq <rumpf_a@web.de> | 2020-07-18 21:40:44 +0200 |
---|---|---|
committer | Araq <rumpf_a@web.de> | 2020-07-18 21:40:57 +0200 |
commit | ffe7b3a9bf1596e5016c8fcaf775f9261188d349 (patch) | |
tree | 451f8e9923064e90110c754198d645b4663eac6c | |
parent | ae358a0c7a5f7b14e5dde259cd6ce02b235985a3 (diff) | |
download | Nim-ffe7b3a9bf1596e5016c8fcaf775f9261188d349.tar.gz |
threadpool.nim: minor code style changes
-rw-r--r-- | lib/pure/concurrency/threadpool.nim | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/lib/pure/concurrency/threadpool.nim b/lib/pure/concurrency/threadpool.nim index 2abcafb80..f0269f526 100644 --- a/lib/pure/concurrency/threadpool.nim +++ b/lib/pure/concurrency/threadpool.nim @@ -208,7 +208,7 @@ proc finished(fv: var FlowVarBaseObj) = # the worker thread waits for "data" to be set to nil before shutting down owner.data = nil -proc `=destroy`[T](fv: var FlowVarObj[T]) = +proc `=destroy`[T](fv: var FlowVarObj[T]) = finished(fv) `=destroy`(fv.blob) @@ -321,15 +321,15 @@ var currentPoolSize: int maxPoolSize = MaxThreadPoolSize minPoolSize = 4 - gSomeReady : Semaphore + gSomeReady: Semaphore readyWorker: ptr Worker # A workaround for recursion deadlock issue # https://github.com/nim-lang/Nim/issues/4597 var numSlavesLock: Lock - numSlavesRunning {.guard: numSlavesLock}: int - numSlavesWaiting {.guard: numSlavesLock}: int + numSlavesRunning {.guard: numSlavesLock.}: int + numSlavesWaiting {.guard: numSlavesLock.}: int isSlave {.threadvar.}: bool 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 ## 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 ## call in the calling thread. ## |