/home/animuspexus/dlang/d_v2.098.0/dmd/generated/linux/release/64/../../../../../phobos/std/parallelism.d(436):
 Error: need `this` for `threadFunc` of type `void()`
./t.d(22): Error: template instance `std.parallelism.Task!(threadFunc)` error instantiating


thou documentation says `a function (or delegate or other callable)`

```D

import std.stdio;
import std.parallelism;


class TC {
        
        void threadFunc()
        {
                import core.thread;
                import core.time;
                
                scope(exit) writeln("threadFunc done");
                
                core.thread.osthread.Thread.getThis.sleep(msecs(2000));
                
        }
        
        void threadCreator()
        {
                scope(exit) writeln("threadCreator done");
                auto t1 = Task!threadFunc;
                t1.executeInNewThread();
                
        }
        
}


void main()
{
        scope(exit) writeln("main done");
        
        auto tc = new TC;
        tc.threadCreator();
        
}

```

Reply via email to