I think I just found out my problem. How stupid of me, I should've created an instance of lock in the class Process instead of class Send. Good Heaven's python's threading rocks! I stress tested the server script having two clients sending requests on a while 1 loop without even a time.sleep() and yet it still runs! ^_^
class Process(threading.Thread): lock = threading.Lock() # Lock instance should be placed here def __init__(self,query) self.query = query threading.Thread.__init__(self) def run(self): ''' Some data processing code here ''' Process.lock.acquire() cursor.execute(query) Process.lock.release() class Send(Request__POA.Send): def push(self,query,...some args here): Process(query).start() db = MySQL().connect() cursor = db.make_cursor() -- http://mail.python.org/mailman/listinfo/python-list