Runtime error when calling a callback in a parallel Task

BBasile via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Tue Sep 15 16:49:21 PDT 2015


Under Windows this works fine but under Linux I got a runtime 
error.

this could be reduced to :

---
import std.parallelism;

alias CallBack = void function(void*);

class Foo
{
     CallBack clbck;
     void* param;
     void dotask()
     {
         // some heavy processing
         // tells the caller that some fresh data are available
         if(clbck) clbck(param);  // debugger breaks HERE
     }

     void call()
     {
         task(&dotask).executeInNewThread;
         // returns directly but the caller will get a notif when 
finished
     }
}
---

more info about the environment:
- linux i386
- the D program is actually a .so and the main thread is the exe 
that loads this .so.
- If i don't use a Task then the program works **fine**.

Is it possible to achieve this in a cross platform-way ?
How can i get in phase with the main big thread at the end of my 
task ?


More information about the Digitalmars-d-learn mailing list