Foreign threads in D code.
Igor Shirkalin via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Wed Jul 12 11:00:42 PDT 2017
On Wednesday, 12 July 2017 at 09:49:32 UTC, Guillaume Piolat
wrote:
> On Tuesday, 11 July 2017 at 22:59:42 UTC, Igor Shirkalin wrote:
>>>> [...]
>>>
>>> --
>>> Biotronic
>>
>> Thanks for very useful information!
>
> Just one small note.
> If you don't know the foreign thread lifetime, it's cleaner to
> detach it from the runtime upon exit.
>
> Else may fall in the following scenario.
> 1. you register thread A
> 2. thread A is destroyed later on, in the C++ code
> 3. another thread B come into your callback and allocate. The
> GC triggers and try to pause a non-existing thread A.
This is important note. Yes, usually the lifetime of foreign
thread is unknown.
You, guys, helped me a lot.
More information about the Digitalmars-d-learn
mailing list