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

Bienlein ffm2002 at web.de
Mon Oct 3 14:44:53 UTC 2022


On Monday, 3 October 2022 at 10:13:09 UTC, Rene Zwanenburg wrote:
> 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();
> }
> ```

Oh, that simple... Thanks a lot :-).


More information about the Digitalmars-d-learn mailing list