Re: Python Embedding Thread

2008-07-23 Thread Graham Dumpleton
On Jul 23, 12:15 pm, "Jaimy Azle" <[EMAIL PROTECTED]> wrote: > <[EMAIL PROTECTED]> wrote: > > I fixed the code. This code snippet runs in a seperate thread: > > > PyObject *dict=NULL; > > PyGILState_STATE state = PyGILState_Ensure(); > > dict = CreateMyGlobalDictionary(); > > > PyRun_String(, Py_fi

Re: Python Embedding Thread

2008-07-22 Thread Jaimy Azle
<[EMAIL PROTECTED]> wrote: > I fixed the code. This code snippet runs in a seperate thread: > > > PyObject *dict=NULL; > PyGILState_STATE state = PyGILState_Ensure(); > dict = CreateMyGlobalDictionary(); > > PyRun_String(, Py_file_input, dict, dict); > > ReleaseGlobalDictionary(dict); > > But it s

Re: Python Embedding Thread

2008-07-22 Thread googler . 1 . webmaster
Hi! I fixed the code. This code snippet runs in a seperate thread: PyObject *dict=NULL; PyGILState_STATE state = PyGILState_Ensure(); dict = CreateMyGlobalDictionary();

Re: Python Embedding Thread

2008-07-21 Thread googler . 1 . webmaster
Hi! Thank you very much for your answers. I have a menue with a script in it. So my app starts a new thread for each script. So I would like to run two scripts all the same time. Could someone give me a tip, what I have to set in my code? Thank you :) -- http://mail.python.org/mailman/listinfo/p

Re: Python Embedding Thread

2008-07-21 Thread Jaimy Azle
"Benjamin" <[EMAIL PROTECTED]> wrote: > Two threads should not be running through the Python VM concurrently > in the same process. The GIL has to be held *any* time you use the > Python API. When you want to release the GIL (to process something in > C), use PY_BEGIN_ALLOW_THREADS and > PY_END_AL

Re: Python Embedding Thread

2008-07-21 Thread Benjamin
On Jul 21, 6:56 am, [EMAIL PROTECTED] wrote: > Hi :) > > I want to run Python in my app. That works still fine. But my app > supports now Threads and I would like to know what to do, that it runs > without problems. > > PyGILState_Release and PyGILState_Ensure should solve the problem > right? Wher

Re: Python Embedding Thread

2008-07-21 Thread googler . 1 . webmaster
Does anyone has a tip? -- http://mail.python.org/mailman/listinfo/python-list

Python Embedding Thread

2008-07-21 Thread otr2
Hi :) I want to run Python in my app. That works still fine. But my app supports now Threads and I would like to know what to do, that it runs without problems. PyGILState_Release and PyGILState_Ensure should solve the problem right? Where do I have to put this two commands around? between each C