How can execute method in new Thread?
Marcone
marcone at email.com
Sat Nov 14 17:21:15 UTC 2020
My simple example code:
import std;
struct Fruit {
string name;
this(string name){
this.name = name;
}
void printmyname(){
writeln(this.name);
}
void showname(){
task!this.printmyname().executeInNewThread(); // Error here!!
Can not send this.printmyname() tonew thread.
}
}
void main(){
Fruit f = Fruit("Banana");
f.showname();
}
Error:
D:\dmd2\windows\bin\..\..\src\phobos\std\parallelism.d(516):
Error: struct `Fruit` does not overload ()
More information about the Digitalmars-d-learn
mailing list