summary refs log tree commit diff stats
path: root/lib
diff options
context:
space:
mode:
authorflywind <xzsflywind@gmail.com>2021-12-10 01:49:31 +0800
committerGitHub <noreply@github.com>2021-12-09 18:49:31 +0100
commit4f64c9fae5e46d73d226f7d5b86d518d034be7b3 (patch)
tree4a6532b17543260f92e871d7634dac95a5612737 /lib
parent99f8793502e65cd43f6e301557d428758948c3ca (diff)
downloadNim-4f64c9fae5e46d73d226f7d5b86d518d034be7b3.tar.gz
add comments to spawn and pinnedSpawn (#19230)
`spawn` uses `nimSpawn3` internally and `pinnedSpawn` uses `nimSpawn4` internally. I comment it in order to help contributors get the gist of its functionality.
Diffstat (limited to 'lib')
-rw-r--r--lib/pure/concurrency/threadpool.nim6
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/pure/concurrency/threadpool.nim b/lib/pure/concurrency/threadpool.nim
index f8a5f9ba8..9334b4833 100644
--- a/lib/pure/concurrency/threadpool.nim
+++ b/lib/pure/concurrency/threadpool.nim
@@ -448,19 +448,21 @@ proc preferSpawn*(): bool =
   ## <#spawnX.t>`_ instead.
   result = gSomeReady.counter > 0
 
-proc spawn*(call: sink typed) {.magic: "Spawn".}
+proc spawn*(call: sink typed) {.magic: "Spawn".} =
   ## Always spawns a new task, so that the `call` is never executed on
   ## the calling thread.
   ##
   ## `call` has to be a proc call `p(...)` where `p` is gcsafe and has a
   ## return type that is either `void` or compatible with `FlowVar[T]`.
+  discard "It uses `nimSpawn3` internally"
 
-proc pinnedSpawn*(id: ThreadId; call: sink typed) {.magic: "Spawn".}
+proc pinnedSpawn*(id: ThreadId; call: sink typed) {.magic: "Spawn".} =
   ## Always spawns a new task on the worker thread with `id`, so that
   ## the `call` is **always** executed on the thread.
   ##
   ## `call` has to be a proc call `p(...)` where `p` is gcsafe and has a
   ## return type that is either `void` or compatible with `FlowVar[T]`.
+  discard "It uses `nimSpawn4` internally"
 
 template spawnX*(call) =
   ## Spawns a new task if a CPU core is ready, otherwise executes the