Task when used on a function that takes parameters doesnt work.

Ruby The Roobster michaeleverestc79 at gmail.com
Thu Nov 12 15:01:47 UTC 2020


Here is a test that I did:

void func(int i)
{
Thread.sleep(i.seconds);
}
void main() {
auto test = Task!func(3);
test.executeInNewThread();
test.yeildForce();
}

This gives the following errors(I'm using Code::Blocks as an IDE 
by the way, so this is what the IDE outputted):
d:\Programs\D\dmd2\windows\bin\..\..\src\phobos\std\parallelism.d|516|Error: function `hello.func(int i)` is not callable using argument types `()`|

d:\Programs\D\dmd2\windows\bin\..\..\src\phobos\std\parallelism.d|516|       missing argument for parameter #1: `int i`|

hello.d|8|Error: template instance `std.parallelism.Task!(func)` 
error instantiating|


Any fix for this?


More information about the Digitalmars-d-learn mailing list