User Tools

Site Tools


Sidebar

fibers:fiber.create

Q. I wanted to start two fibers in one instance. The first one started successfully, but it seems the second one didn't start at all.

On the instance:

local m = require('test').start()

In test.lua:

local function start

frun = fiber.create(queue.run(pool))
ffill = fiber.create(queue.fill(pool))

queue.run is working, queue.fill is not. What did I do wrong? (2017)

A. You need to pass in parameters differently: fiber.create(queue.run, pool) - this is going to work.

fiber.create expects a function to run in the fiber and its arguments, while you are passing in queue.run(pool), which executes queue.run and tries to pass its result to fiber.create.

Comments

Enter your comment. Wiki syntax is allowed:
X S Z A O
 
fibers/fiber.create.txt · Last modified: 2018/05/25 21:26 by eabates

Real Time Web Analytics