For threading I use usually this recipe as a base: http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/65448, I think you can use it for your purpose as well.