Re: How to call python from a foreign language thread (C++)

2009-02-05 Thread Philip Semanchuk
On Feb 3, 2009, at 11:37 PM, Victor Lin wrote: It does not work. But however, thanks your help. I have tired so many methods to do. But it crash...crash..deadlock...deadlock..crash...crash... I have no any tried success. I am going crazy. Could someone help me, thanks. Hi Victor, I have some

Re: How to call python from a foreign language thread (C++)

2009-02-04 Thread Mark Hammond
On 4/02/2009 8:43 PM, I wrote: PyGILState_STATE old = PyGILState_Acquire(); Make that PyGILState_Ensure(); Mark -- http://mail.python.org/mailman/listinfo/python-list

Re: How to call python from a foreign language thread (C++)

2009-02-04 Thread Mark Hammond
On 4/02/2009 4:51 AM, Victor Lin wrote: It may looks like this. void operator() (double time, const AudioData&data) { // acquire lock m_Function(time, data); // release lock } You want something like: void operator() (double time, const AudioData&dat

Re: How to call python from a foreign language thread (C++)

2009-02-03 Thread Victor Lin
On 2月4日, 上午2時44分, Philip Semanchuk wrote: > On Feb 3, 2009, at 12:51 PM, Victor Lin wrote: > > > > > It seems that my program can't call to Python's function from thread > > directly, because there is Global Interpreter Lock. The python's GIL > > is so complex, I have no idea how it works. I'm sor

Re: How to call python from a foreign language thread (C++)

2009-02-03 Thread Philip Semanchuk
On Feb 3, 2009, at 12:51 PM, Victor Lin wrote: It seems that my program can't call to Python's function from thread directly, because there is Global Interpreter Lock. The python's GIL is so complex, I have no idea how it works. I'm sorry, what I can do is to ask. My question is. What should I

How to call python from a foreign language thread (C++)

2009-02-03 Thread Victor Lin
Hi, I am developing a program that use DirectShow to grab audio data from media files. DirectShow use thread to pass audio data to the callback function in my program, and I let that callback function call another function in Python. I use Boost.Python to wrapper my library, the callback function