Simple threaded python that manage deadlock.