On Fri, 13 May 2005 09:10:13 -0400, Peter Hansen wrote: > > How did you intend to stop the thread in a manner which might be unsafe? > (Hint, unless you're doing something unusual, you can't.) >
I have a threaded object (Mythread). It checks if want_thread variable is True to return. The problem is that this object execute a function that is a tcp comunication def Client(self,Request,Answer): totalsent = 0 while totalsent < 608: sent = self.sock.send(Request.struct2string()[totalsent:]) if sent == 0: raise RuntimeError, "socket broken" totalsent = totalsent + sent if Request.Codigo != 37: self.WriteLog("Request",Request) data = self.sock.recv(608) Answer.string2struct(data) if int(Answer.Param[9]) != 37: self.WriteLog("Answer",Answer) The Client function send a Request (them write it in a log file), gets and answer and and write it. The problem is that when i stop the thread a get somethime the Request writed but not the answer, as if the funciton Client returns before it ends. Zunbeltz > -Peter -- http://mail.python.org/mailman/listinfo/python-list