Maybe not possible here, but general suggestion is: Don't do threading in python, use forked processes instead.  The python global_interpreter_lock almost always results in "threading" code actually just all running in serial.  Also, in general it's good to avoid using global variables if possible.  Just some tips.