[[!tag programming dimbola]]

I've started to slowly clean up the Dimbola code base. I seem to have cut more corners than I thought.

One of the problems was that all processing was done in the main UI thread. Whenever the program was doing something heavy, the UI would freeze. This is obviously not good.

After hitting my head often enough against the wall, I've concluded that using threads with Python and, especially, GTK+, is too tricky to be worthwhile. I much prefer the Python multiprocessing module instead: it reduces the problems of concurrency greatly by running things in their own processes, rather than threads.

Given the Python global interpreter lock, this process based approach also helps by making it easier to use every CPU core available, which can really help with heavy stuff.

I made a module in Dimbola to abstract use of multiprocessing a bit. This should make it quite straightforward to do things in the background. The bgjobs module might be useful for others, as well.

I hope I got all the details working with this. Even with multiprocessing and its queues and other helpers, concurrency is a tricky beast.

I've also made the PyGTK binding magic I mentioned earlier available as a module.