Thread overview | |||||
---|---|---|---|---|---|
|
February 16, 2017 Can't send messages to tid spawned in a Windows DLL. Bug? | ||||
---|---|---|---|---|
| ||||
This fails for me in a DLL: auto tid = spawn(&func); assert(tid != Tid.init); If I print out the tid, I find that its message box is null. This is odd, since according the code in std.concurrency there's nothing weird about how it gets a message box, it's just `auto spawnTid = Tid(new MessageBox);`. So... `new` is returning null??? The really weird thing is that a thread is spawned and func starts executing. I just can't send it any messages without crashing. Atila |
February 16, 2017 Re: Can't send messages to tid spawned in a Windows DLL. Bug? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Atila Neves | On Thursday, 16 February 2017 at 12:07:40 UTC, Atila Neves wrote:
> This fails for me in a DLL:
>
> auto tid = spawn(&func);
> assert(tid != Tid.init);
>
> If I print out the tid, I find that its message box is null. This is odd, since according the code in std.concurrency there's nothing weird about how it gets a message box, it's just `auto spawnTid = Tid(new MessageBox);`. So... `new` is returning null???
>
> The really weird thing is that a thread is spawned and func starts executing. I just can't send it any messages without crashing.
>
> Atila
If you suspect `new` of returning null, a GC issue seems likely. Is your DLL linked statically against druntime, thus having its own GC? Or are you using a shared druntime (and thus GC) across multiple binaries?
|
February 16, 2017 Re: Can't send messages to tid spawned in a Windows DLL. Bug? | ||||
---|---|---|---|---|
| ||||
Posted in reply to kinke | On Thursday, 16 February 2017 at 15:14:25 UTC, kinke wrote:
> On Thursday, 16 February 2017 at 12:07:40 UTC, Atila Neves wrote:
>> This fails for me in a DLL:
>>
>> auto tid = spawn(&func);
>> assert(tid != Tid.init);
>>
>> If I print out the tid, I find that its message box is null. This is odd, since according the code in std.concurrency there's nothing weird about how it gets a message box, it's just `auto spawnTid = Tid(new MessageBox);`. So... `new` is returning null???
>>
>> The really weird thing is that a thread is spawned and func starts executing. I just can't send it any messages without crashing.
>>
>> Atila
>
> If you suspect `new` of returning null, a GC issue seems likely. Is your DLL linked statically against druntime, thus having its own GC? Or are you using a shared druntime (and thus GC) across multiple binaries?
Whatever's default on Windows 32-bit. The thing is, all other uses of GC allocations in the same DLL work as expected.
Atila
|
Copyright © 1999-2021 by the D Language Foundation