On Tuesday 10 March 2009 19:40:48 McKay Davis wrote:
> On Tue, Mar 10, 2009 at 11:08 AM, Phil Thompson
>
> <p...@riverbankcomputing.com> wrote:
> > On Tue, 10 Mar 2009 10:30:04 -1000, McKay Davis <mckay....@gmail.com>
> >
> > wrote:
> >> After no response, maybe more specifics with our Multi-Threaded Python
> >> w/ PyQt problem would help:
> >>
> >> In the main thread, we do:
> >>
> >> PyEval_InitThreads(); // acquires the lock
> >> PyInitialize();
> >> // other init stuff
> >> PyThread_release_lock()
> >>
> >> …and in each new Python thread we do:
> >> Py_NewInterpreter()
> >> …
> >> PyThreads_release_lock()
> >>
> >> We call release()/acquire() blocks whenever the python script does a
> >> blocking operation.  A specific example of a lockup with PyQT is
> >> running examples/tutorial/t8.pyw.  We basically:
> >>
> >> PyThreads_acquire_lock()
> >> <run example script>
> >> PyThreads_release_lock()
> >>
> >> When a slot is invoked as a result of the slider being moved we get a
> >> deadlock.  This happens when sip_ProtectVirt_languageChange calls
> >> PyThreads_release_lock() on an already released lock.  If we don’t
> >> release the lock after the main thread PyQT script code runs, then the
> >> script runs fine – but our other python script threads will be starved
> >> out.
> >>
> >> Anybody have any ideas on how to resolve this deadlock?
> >
> > PyQt uses the PyGILState_* functions. These aren't supported with
> > multiple interpreters - see the docs for Py_NewInterpreter().
>
> So its not possible to run PyQt with multiple python interpreters?
>
> This is too bad, because we require the ability to allow users to
> script our application using Python.  But, we would also like to
> internally use PyQt for GUI development.  If we only have one
> interpreter then we cannot use PyQt because we cannot allow end-users
> the ability to potentially develop PyQt under the commercial license.

Why not use multiprocessing and some sort of message passing via queues? Of 
course maybe I am not understanding what you are trying to do :-)

> Is there a way to allow only our program to access PyQt and end-users
> access to the python interpreter too?
>
> -McKay
>
> _______________________________________________
> PyQt mailing list    PyQt@riverbankcomputing.com
> http://www.riverbankcomputing.com/mailman/listinfo/pyqt


_______________________________________________
PyQt mailing list    PyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt

Reply via email to