Does anyone have any recommended ideas/ways of implementing a proper control and status protocol for communicating with threads? I have a program that spawns a few worker threads, and I'd like a good, clean way of communicating the status of these threads back to the main thread. Each thread (wrapped in a very simple class) has only a few states, and progress levels in those states. And sometimes they can error out, although if the main thread knew about it, it could ask the thread to retry (start over). How would any of you do this? A callback method that the thread can call (synchronizing one-way variables isn't a problem)? A queue? How would the main thread check these things? Currently the main thread is polling some simple status variables. This works, and polling will likely continue to be the simplest and easiest way, but simple status variables are very limited. Are there any pythonic patterns people have developed for this.
thanks. Michael -- http://mail.python.org/mailman/listinfo/python-list