How do I launch multiple threads?

I seem to have problem interacting with QT widgets from different Python
threads.

My application starts in  C++

Py_Initialize()
PySys_SetArgv(argc, argv);
PyRun_SimpleFile(iPythonScript, PythonScript);

in PythonScript
app = QApplication( sys.argv)
Generate my widgets
sys.stderr = MultiLineText.PyErr
sys.stdout = MultiLineText.PyRes
sys.stdin = MultiLineText.PyInput
app.connect(app, SIGNAL('lastWindowClosed()'), app, SLOT('quit()') );
app.exec_loop()

def write(self,sText):
    MultiLineText.insert(sText)

on the click of a button somewhere
    thread.start_new_thread(foo, ())
    thread.start_new_thread(foo, ())
    thread.start_new_thread(foo, ())


def foo():
    print "Something"
    do something
    print "Something"
    do something
    print "Something"
    do something
    print "Something"

The program freezes deadlock

Any suggestions?

Barbod





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

Reply via email to