[PyKDE] QWaitCondition seems to cause deadlock
phil at riverbankcomputing.co.uk
Tue May 18 20:14:01 BST 2004
On Tuesday 18 May 2004 5:58 pm, 森田 慎一 wrote:
> Hi, this is shin.
> It's my first time to post to this ml.
> I'm a beginner of PyQt.
> PyQt is very exciting!!
> But I have a problem on my multi-thread script.
> This script uses Qt thread API, and uses QMutex and
> QWaitCondition to synchronize a GUI thread and a worker
> When the worker thread calls QWaitCondition.wait(), GUI
> thread also stops running.
> It seems to be in deadlock state.
> The worker's code is as follows:
> def postAndWait(self)
> # waits until GUI thread processes the posted event.
> condition.wait(mutex) # <-- stops everything!!
> GUI thread processes events as follows:
> def customEvent(self, event)
> # do something ...
> I've been at a loss for a few days.
> But today I found that Python Global Interpreter Lock
> needs to be released and reacquired around blocking
> operation according to Python C/API Reference Manual.
> And I also found that QWaitCondition::wait() in
> qwaitcondition.sip has no annotation while
> QThread::sleep() has /ReleaseGIL/ annotation.
> I think that QWaitCondition::wait() must have /ReleaseGIL/
> annotation, is that right?
Reading the documentation, I think you are right. It looks like it's missing
on QMutex.lock() as well. Tonight's snapshot should be fixed.
More information about the PyQt