www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - Concurrency in DLL

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?
Jul 01 2015