<div dir="ltr"><div dir="ltr"><br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Thu, Nov 12, 2020 at 4:12 PM Daniel Kozak <<a href="mailto:kozzi11@gmail.com">kozzi11@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div dir="ltr"></div><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Thu, Nov 12, 2020 at 4:05 PM Ruby The Roobster via Digitalmars-d-learn <<a href="mailto:digitalmars-d-learn@puremagic.com" target="_blank">digitalmars-d-learn@puremagic.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Here is a test that I did:<br>
<br>
void func(int i)<br>
{<br>
Thread.sleep(i.seconds);<br>
}<br>
void main() {<br>
auto test = Task!func(3);<br>
test.executeInNewThread();<br>
test.yeildForce();<br>
}<br>
<br>
This gives the following errors(I'm using Code::Blocks as an IDE <br>
by the way, so this is what the IDE outputted):<br>
d:\Programs\D\dmd2\windows\bin\..\..\src\phobos\std\parallelism.d|516|Error: function `hello.func(int i)` is not callable using argument types `()`|<br>
<br>
d:\Programs\D\dmd2\windows\bin\..\..\src\phobos\std\parallelism.d|516|       missing argument for parameter #1: `int i`|<br>
<br>
hello.d|8|Error: template instance `std.parallelism.Task!(func)` <br>
error instantiating|<br>
<br>
<br>
Any fix for this?<br></blockquote><div><br></div><div>You have some typos there</div><div><br></div>import core.thread;<br>import std.parallelism;<br><br>void func(int i)<br>{<br>    Thread.sleep(i.seconds);<br>}<br>void main() {<br>    auto test = task!(func)(3);<br>    test.executeInNewThread();<br>    test.yieldForce();<br><div>} </div></div></div></blockquote><div><br></div><div>Typos: instead of Task you should write task, instead of  yeildForce you should write yieldForce</div></div></div>