Callback from c thread with ctypes

Christian Heimes lists at cheimes.de
Sun Mar 8 10:36:45 EDT 2009


Victor Lin wrote
> I know I have to call PyEval_InitThreads if my module create threads
> that will contact python stuff, for example, call a python callback
> function from threads. But however, it is ctypes. I have no idea
> should I do that for the imported dll? If it is, how?

You have to initialize the thread state for the current thread, too. See
Python/pystate.c:PyThreadState_New()




More information about the Python-list mailing list