Calling into Python from a C thread
Philip Semanchuk
philip at semanchuk.com
Mon Feb 9 15:38:17 EST 2009
On Feb 9, 2009, at 2:35 PM, Christian Heimes wrote:
> Philip Semanchuk wrote:
>> I didn't know there *was* such a thing. Thanks for the tip! For those
>> who might be interested, the list is here:
>> http://mail.python.org/mailman/listinfo/capi-sig
>>
>>
>> FYI, I got my code working and it is in the latest release of
>> posix_ipc:
>> http://semanchuk.com/philip/posix_ipc/
>>
>> The function MessageQueue_request_notification() does some necessary
>> setup and the function process_notification() does the rest of the
>> work.
>
> Let me guess. You either forgot to start Python's threading system or
> you didn't register you thread with Python. You need to deal with
> PyThread_init_thread(), PyEval_InitThreads(), PyThreadState_New(),
> PyThreadState_Clear() and PyThreadState_DeleteCurrent(). The module
> Modules/threadmodule.c contains some examples.
Yes, that's accurate except for the word "forgot". To forget something
one must first know it. =) I found the threading API documentation
difficult to follow, but I suppose that what I'm doing is a little
unusual so if it is not well-documented territory, that's what I get
for wandering off the map.
More information about the Python-list
mailing list