threading issues with D -> C -> Python

Ellery Newcomer via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Sun Dec 7 17:17:15 PST 2014


On 12/07/2014 03:12 PM, Michael wrote:
> On Saturday, 6 December 2014 at 00:40:49 UTC, Ellery Newcomer wrote:
>> On 12/04/2014 10:55 PM, Ellery Newcomer wrote:
>>
>>> I guess tomorrow I can try messing around with thread_attachThis, as the
>>> fullcollect happening in #2 might be screwing with python data. But you
>>> aren't really passing anything from python to d or vice versa, so I'm
>>> not sure why the gc would need to know about the python threads.
>>
>> by gum, thread_attachThis and thread_detachThis fix the issue!
>>
>> now to figure out how to use them in the general case.
>
> This is great.. Thank you. I'm looking forward to being able to try the
> finished result.

It would be great if there were some convenient hook in python to stick 
these calls. Near as I can tell, there isn't. That leaves you with 
either explicitly calling attach and detach with an exposed api, or pyd 
obsessively checking whether the current thread is registered.

Actually, I suppose with a thread local flag the latter wouldn't be too bad.

Mind if I incorporate your example into pyd's test suite?


More information about the Digitalmars-d-learn mailing list