threading issues with D -> C -> Python

Michael via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Mon Dec 8 19:46:33 PST 2014


On Monday, 8 December 2014 at 01:17:16 UTC, Ellery Newcomer wrote:
> 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?

Not at all. Go for it.


More information about the Digitalmars-d-learn mailing list