ok, how would i have it re-initialize itself ?<br><br>yes, i want to do this on a failure condition. <br>something wrapped in a try - except<br><br>its long and complicated dealing with talking to a dataserver over ip and 
<br>passing byte streams back and forth. <br><br>i just need to do this for testing to see where something is failing and how soon <br>i could re-connect to the data server.<br><br>whew !<br><br>thanks<br>shawn<br><br><div>
<span class="gmail_quote">On 7/20/07, <b class="gmail_sendername">Kent Johnson</b> &lt;<a href="mailto:kent37@tds.net">kent37@tds.net</a>&gt; wrote:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
shawn bright wrote:<br>&gt; If i have a thread, of type threading.Thread<br>&gt; that i initiate with an __init__<br>&gt; in the<br>&gt; def run(self):<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;while 1:<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; do some stuff<br>&gt;<br>&gt;
<br>&gt; is there a way i can stop this thread and restart this thread from<br>&gt; within itself ?<br><br>No. A thread stops by exiting the run method, then it is done. And how<br>would a stopped thread restart itself?<br>
<br>What you can do, is write your run() method to do whatever you want; in<br>particular it could sense some condition and re-initialize itself.<br><br>If you are using a Thread subclass and overriding run() (as opposed to
<br>passing the run method to the constructor) you can use the subclass to<br>hold any state you need and you can write/call any other methods you need.<br><br>Kent<br></blockquote></div><br>