Janez Jere mailed me the other day about using threading in PyQt, and I
found that I couldn't get a working solution myself.

First, qApp.lock() or qApp.unlock() always seems to segfault. Without locking
the application, one shouldn't call methods on QWidgets, of course, so that
will lead to a segfault, too.

Finally, when I run the script without locking, without accessing the GUI, I 
can get a working run, sometimes. Look at the result of running thread2.py
three times:

boud@calcifer:~> python thread2.py
0
0
1
1
2
2
3
3
4
4
Fatal Python error: PyEval_RestoreThread: NULL tstate
Aborted
boud@calcifer:~> 5
5
6

boud@calcifer:~> python thread2.py
0
0
Fatal Python error: PyThreadState_Get: no current thread
Fatal Python error: PyThreadState_Get: no current thread
Aborted
boud@calcifer:~> python thread2.py
0
0
Fatal Python error: PyThreadState_Get: no current thread
Aborted

(The first run I pressed ctrl-c  to end it.)
-- 
Boudewijn Rempt | http://www.valdyas.org


_______________________________________________
PyKDE mailing list    [EMAIL PROTECTED]
http://mats.gmd.de/mailman/listinfo/pykde

Reply via email to