Why does not this snipplet work?
-----------------------------------------------------------------
from job import JobQueue
import Queue
import threading
import gobject
q=JobQueue()
def worker():
    print "Worker waiting"
    q.get()
    print "Got job!"

if __name__ == "__main__":
    t = threading.Thread(target=worker)
    t.start()
    q.put(1)
    loop = gobject.MainLoop()
    loop.run()
---------------------------------------------------------------------
It blocks indefinitely on the q.get() in the worker thread. When I
remove the the gobject main loop call, the code works fine and worker
thread gets to the print "Got job!" statement. This is just simplified
example to show the weird behaviour, otherwise I am trying to receive
messages via DBus and schedule jobs for another thread(I am a DBus
server). So is it a bug, my mistake or just simply queues can't be
used in combination with gobject main loop? Can I use dbus without
main loop(since I really don't need it, but I couldn't find any
example how to get rid of it.

Thank you.
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to