Concurrency in DLL
Chris via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Wed Jul 1 04:31:18 PDT 2015
Would anyone know off the top of the head why a
std.concurrency.send() message can fail in a DLL?
The DLL is loaded into Python and works (including the threading)
when in a test program or mine and loaded via cytpes.CDLL() etc.
However, embedded in a third party package, where it is loaded in
the same way, the thread is never called (the DLL as such is
loaded and available and works fine).
The thread is generated like this in the DLL:
import std.concurrency;
extern(C)
{
export void methodCalledFromPython(const char* message)
{
// convert message to string etc.
// now spawn thread in order to be able to return to
// main thread asap
auto dothis = spawn(&doSomething, thisTid);
send(dothis, message.idup);
}
}
// Method in same module
private void doSomething(Tid tid)
{
receive(
(string input)
{
// Do something with input
}
);
}
Is it to do with thisTid that conflicts with the main program
somehow? However, in my test program it works fine. Anything I'm
forgetting here?
More information about the Digitalmars-d-learn
mailing list