Friday, December 10, 2010

Threading in Dialcentral

So this is a bit more boring of a post.  Pretty much everything went as expected.  The only annoyance  as part of my zeal to avoid concrete inheritance was that Maemo 4.1 seems to have too old of a version of Qt to avoid inheriting from QThread.  That page has some better practice listings for QThread.

DialCentral original used threading to be lazy about startup and to avoid the slowest of operations from blocking the UI thread.  I've now pushed all blocking operations to a thread.  The main question was what approach I would take to  threading in PyQt.  I was tempted to keep using Python threads using GObject callbacks but I keep to one toolkit for simplicity.

In The One Ring I had some code that used generators to trampoline code to the worker thread.  I just had to refactor it so that there were toolkit specific and toolkit agnostic components.

I was glad that python logging works smoothly with QThreads.  The messages get marked with some kind of distinguishing identifier.

See, nice and boring.  No real issue which to me is a plus.