cfunction
src/core/fiber.c on line 466 , column 1
(fiber/setenv fib tab )
Sets the environment table for a fiber `fib` to `tab` . Set to nil
to remove the current environment.
(def server # name it, to close it after
(with-dyns [:foo "foo" ]
(def env (curenv )) # must make a closure, otherwise it will use the fiber's env
(net/server "0.0.0.0" 9092 # starts a fiber
(fn [conn ]
# pass the saved env:
(fiber/setenv (fiber/current ) (table/setproto @{} env ))
(:write conn (dyn :foo )) # n.b. stringify if using other :foo value
(:close conn ))
:stream )))
(:read (net/connect "127.0.0.1" 9092 ) 1024 )
(:close server )