View Single Post
Old 06-11-2011, 05:30 PM   #39
kovidgoyal
creator of calibre
kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.
 
kovidgoyal's Avatar
 
Posts: 45,445
Karma: 27757438
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
While I agree that the comment of FunctionDispatcher claims that it calls the function in the thread that it was created in, the situation isn't that clear cut.

From the Qt docs at http://doc.qt.nokia.com/latest/threa...across-threads

Queued Connection The slot is invoked when control returns to the event loop of the receiver's thread. The slot is executed in the receiver's thread.

That, in this case, means the thread the FD object was created in as the comment claims. However, if the thread does not have an event loop (which is almost always the case for all non GUI threads in calibre), I'm guessing it is actually called in the GUI thread.

Perhaps a good solution is to raise an exception in FD.__init__ if the current thread is not the GUI thread.
kovidgoyal is offline   Reply With Quote