How create a function that receive a function and run it in another threading?

Marcone marcone at email.com
Fri Dec 27 06:08:16 UTC 2019


import std;
import core.thread;

auto threading(lazy void fun){ return 
task!fun().executeInNewThread(); }

void main(){
	threading(writeln("Hello World!"));
}


I want to create a function threading() to run some function in 
other threading, but I get this error bellow. How can I get 
success?


Error: static function Programa.threading.Task!(fun).Task.impl 
cannot access frame of function Programa.threading
Error: template instance `Programa.threading.Task!(fun)` error 
instantiating


More information about the Digitalmars-d-learn mailing list