digitalmars.D.learn - Concurrency on Windows (spawn)
- Chris (8/8) Jun 18 2014 Windows: in a D-DLL I'm trying to spawn a thread. However,
- Chris (4/12) Jun 18 2014 Mystery solved. There was an audio delay so that the program had
- =?UTF-8?B?QWxpIMOHZWhyZWxp?= (9/24) Jun 18 2014 That can happen on Linux as well. So, the owner may have to call
Windows: in a D-DLL I'm trying to spawn a thread. However, nothing happens auto myThread = spawn(&myFunction, thisTid); send(myThread, arg); The thread is never called. Any ideas? Thanks! PS In an old DLL it used to work, there I called it with only one argument, i.e. spawn(&myFunction). Is thisTid messing it up, do I need to pass something else?
Jun 18 2014
On Wednesday, 18 June 2014 at 11:57:06 UTC, Chris wrote:Windows: in a D-DLL I'm trying to spawn a thread. However, nothing happens auto myThread = spawn(&myFunction, thisTid); send(myThread, arg); The thread is never called. Any ideas? Thanks! PS In an old DLL it used to work, there I called it with only one argument, i.e. spawn(&myFunction). Is thisTid messing it up, do I need to pass something else?Mystery solved. There was an audio delay so that the program had already finished, before the thread was properly executed. I _loooove_ Windows! Not!
Jun 18 2014
On 06/18/2014 06:28 AM, Chris wrote:On Wednesday, 18 June 2014 at 11:57:06 UTC, Chris wrote:That can happen on Linux as well. So, the owner may have to call thread_joinAll() to wait for the worker: import core.thread; auto myThread = spawn(&myFunction, thisTid); send(myThread, arg); // ... sometime before the program ends: thread_joinAll(); AliWindows: in a D-DLL I'm trying to spawn a thread. However, nothing happens auto myThread = spawn(&myFunction, thisTid); send(myThread, arg); The thread is never called. Any ideas? Thanks! PS In an old DLL it used to work, there I called it with only one argument, i.e. spawn(&myFunction). Is thisTid messing it up, do I need to pass something else?Mystery solved. There was an audio delay so that the program had already finished, before the thread was properly executed. I _loooove_ Windows! Not!
Jun 18 2014
On Wednesday, 18 June 2014 at 15:03:55 UTC, Ali Çehreli wrote:On 06/18/2014 06:28 AM, Chris wrote:Alternatively, one should use non-daemon threads for this purpose.On Wednesday, 18 June 2014 at 11:57:06 UTC, Chris wrote:That can happen on Linux as well. So, the owner may have to call thread_joinAll() to wait for the worker: import core.thread; auto myThread = spawn(&myFunction, thisTid); send(myThread, arg); // ... sometime before the program ends: thread_joinAll(); AliWindows: in a D-DLL I'm trying to spawn a thread. However, nothing happens auto myThread = spawn(&myFunction, thisTid); send(myThread, arg); The thread is never called. Any ideas? Thanks! PS In an old DLL it used to work, there I called it with only one argument, i.e. spawn(&myFunction). Is thisTid messing it up, do I need to pass something else?Mystery solved. There was an audio delay so that the program had already finished, before the thread was properly executed. I _loooove_ Windows! Not!
Jun 18 2014
On Wednesday, 18 June 2014 at 15:23:11 UTC, Kapps wrote:On Wednesday, 18 June 2014 at 15:03:55 UTC, Ali Çehreli wrote:Yeah, I've read about that, I think Adam mentions this in his cookbook as well. For my application the thread merely plays an audio file and is interrupted as soon as new input comes. The issue only came up, because in a test program the app finished, before Windows started to play (audio delay). In the real world app this isn't a problem cause it stays up an running. But still, I'm experiencing some weird behavior that might be down to the whole threading thing. Happy debugging!On 06/18/2014 06:28 AM, Chris wrote:Alternatively, one should use non-daemon threads for this purpose.On Wednesday, 18 June 2014 at 11:57:06 UTC, Chris wrote:That can happen on Linux as well. So, the owner may have to call thread_joinAll() to wait for the worker: import core.thread; auto myThread = spawn(&myFunction, thisTid); send(myThread, arg); // ... sometime before the program ends: thread_joinAll(); AliWindows: in a D-DLL I'm trying to spawn a thread. However, nothing happens auto myThread = spawn(&myFunction, thisTid); send(myThread, arg); The thread is never called. Any ideas? Thanks! PS In an old DLL it used to work, there I called it with only one argument, i.e. spawn(&myFunction). Is thisTid messing it up, do I need to pass something else?Mystery solved. There was an audio delay so that the program had already finished, before the thread was properly executed. I _loooove_ Windows! Not!
Jun 19 2014