JanetDocsPlaygroundI'm feeling luckyGitHub sign in

fiber/new



    cfunction
    src/core/fiber.c on line 502, column 1

    (fiber/new func &opt 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. If the ev module is enabled, and this 
    fiber is used as an argument to `ev/go`, these "blocked" signals 
    will result in messages being sent to the supervisor channel. 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
    * :t - block termination signals: error + user[0-4]
    * :u - block user signals
    * :y - block yield signals
    * :0-9 - block a specific user signal

    The sigmask argument also can take environment flags. If any 
    mutually exclusive flags are present, the last flag takes 
    precedence.

    * :i - inherit the environment from the current fiber
    * :p - the environment table's prototype is the current environment 
      table


See also:coro1 exampleSign in to add an example
Loading...
(map inc
     (fiber/new |(each x (range 3)
                   (yield x))))
# => @[1 2 3]
sogaiuPlayground