Way to pass params to a function passed to a fiber?

Rene Zwanenburg renezwanenburg at gmail.com
Mon Oct 3 10:13:09 UTC 2022


On Monday, 3 October 2022 at 08:10:43 UTC, Bienlein wrote:
> My question is whether someone has an idea for a better 
> solution.

You can pass a lambda to the fiber constructor. For example:


```
void fiberFunc(int i)
{
     writeln(i);
}

void main()
{
     auto fiber = new Fiber(() => fiberFunc(5));
     fiber.call();
}
```


More information about the Digitalmars-d-learn mailing list