On Wednesday, 18 November 2020 at 16:53:44 UTC, frame wrote:
On Wednesday, 18 November 2020 at 15:01:53 UTC, Vino wrote:
Hi All,

Request your help on how to call a function(listFile) from another function(getFilelist) within the same class(GetDirlist), below is an example code.

I think it's basically the same issue like that recently opened topic:

https://forum.dlang.org/thread/ddxasuvusgibppccl...@forum.dlang.org

You need to pass your class object as argument to a static method or anonymous function.

Hi,

  I made the changes as below , still not working

auto fltask = task!listFile(st);
to
auto fltask = task!({listFile(st);})(this).executeInNewThread();

Error:
/DTECH/LDC/dlang/ldc-1.24.0/bin/../import/std/parallelism.d(516,34): Error: 
function literal __lambda2() is not callable using argument types (GetDirlist)
/DTECH/LDC/dlang/ldc-1.24.0/bin/../import/std/parallelism.d(516,34):        
expected 0 argument(s), not 1
/DTECH/LDC/dlang/ldc-1.24.0/bin/../import/std/parallelism.d(842,16): Error: 
template instance GetDirlist.GetDirlist.getFilelist.__foreachbody2.
Task!(delegate () @system { this.listFile(st); } , GetDirlist) error instantiating instantiated from here: task!(delegate () @system { this.listFile(st); } , GetDirlist)

From,
Vino.B

Reply via email to