background

    Dark Mode
Search:
Group by:
  Source   Edit

Types

Backgrounded = ref object of Continuation
background() produces these   Source   Edit

Procs

proc noop() {.cpsMustJump, cpsMagicCall, ...raises: [], tags: [].}
  Source   Edit
proc noop(c: Backgrounded): Backgrounded {....raises: [], tags: [].}
leaked impl detail; ignore it 😙   Source   Edit

Macros

macro background(call: typed): untyped
Run the first argument, a call, in another thread. Returns a continuation that resolves with the result of the call.

Example:

proc fib(n: int; o: bool = false): int =
  case n
  of 0, 1:
    1
  else:
    fib(n-1) + fib(n-2)

var a = background fib(45)
var b = background fib(44)
assert 1836311903 == recover a
assert 1134903170 == recover b
  Source   Edit