Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add comments to spawn and pinnedSpawn #19230

Merged
merged 1 commit into from
Dec 9, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions lib/pure/concurrency/threadpool.nim
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down