Janet 1.0.0-dev Documentation
(fiber/current) Returns the currently running fiber.
(fiber/getenv fiber) Gets the environment for a fiber. Returns nil if no such table is set yet.
(fiber/maxstack fib) Gets the maximum stack size in janet values allowed for a fiber. While memory for the fiber's stack is not allocated up front, the fiber will not allocated more than this amount and will throw a stack-overflow error if more memory is needed.
(fiber/new func [,sigmask]) Create a new fiber with function body func. Can optionally take a set of signals to block from the current parent fiber when called. The mask is specified as a keyword where each character is used to indicate a signal to block. The default sigmask is :y. For example, (fiber/new myfun :e123) blocks error signals and user signals 1, 2 and 3. The signals are as follows: a - block all signals d - block debug signals e - block error signals u - block user signals y - block yield signals 0-9 - block a specific user signal i - inherit the environment from the current fiber (not related to signals)
(fiber/setenv fiber table) Sets the environment table for a fiber. Set to nil to remove the current environment.
(fiber/setmaxstack fib maxstack) Sets the maximum stack size in janet values for a fiber. By default, the maximum stack size is usually 8192.
(fiber/status fib) Get the status of a fiber. The status will be one of: :dead - the fiber has finished :error - the fiber has errored out :debug - the fiber is suspended in debug mode :pending - the fiber has been yielded :user(0-9) - the fiber is suspended by a user signal :alive - the fiber is currently running and cannot be resumed :new - the fiber has just been created and not yet run