it&#39;s exactly&nbsp; what i need<br><br>Thank you Dino<br><br><div><span class="gmail_quote">2007/10/19, Curt Hagenlocher &lt;<a href="mailto:curt@hagenlocher.org">curt@hagenlocher.org</a>&gt;:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Ah!<div><span class="e" id="q_115b959f502f39b9_1"><br><br>
<div><span class="gmail_quote">On 10/19/07, <b class="gmail_sendername">Dino Viehland</b> &lt;<a href="mailto:dinov@exchange.microsoft.com" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">dinov@exchange.microsoft.com
</a>&gt; wrote:</span>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0px 0px 0px 0.8ex; padding-left: 1ex;">
<div vlink="purple" link="blue" lang="EN-US">
<div>
<p><span style="font-size: 11pt; color: rgb(31, 73, 125);">And we implement that using Thread.Abort (which is the only way we really have to interrupt a thread at an arbitrary point in time) </span><span style="font-size: 11pt; color: rgb(31, 73, 125); font-family: Wingdings;">

J</span><span style="font-size: 11pt; color: rgb(31, 73, 125);">&nbsp; When the user catches it they&#39;ll see it as a KeyboardInterruptException, and we&#39;ll do the right thing for Thread.ResetAbort().&nbsp; </span></p>
<p><span style="font-size: 11pt; color: rgb(31, 73, 125);">&nbsp;</span></p>
<p><span style="font-size: 11pt; color: rgb(31, 73, 125);">If you want to get the exact behavior we cause with Ctrl-C it&#39;s actually:</span></p>
<p><span style="font-size: 11pt; color: rgb(31, 73, 125);">&nbsp;</span></p>
<p><span style="font-size: 11pt; color: rgb(31, 73, 125);">import clr</span></p>
<p><span style="font-size: 11pt; color: rgb(31, 73, 125);">clr.AddReference(&#39;Microsoft.Scripting&#39;)</span></p>
<p><span style="font-size: 11pt; color: rgb(31, 73, 125);">from Microsoft.Scripting.Shell import </span><span style="font-size: 10pt; color: rgb(43, 145, 175);">KeyboardInterruptException</span></p>
<p><span style="font-size: 10pt; color: rgb(43, 145, 175);">main.Abort(KeyboardInterruptException(&quot;&quot;))</span></p>
<p><span style="font-size: 10pt; color: rgb(43, 145, 175);">&nbsp;</span></p>
<p><span style="font-size: 10pt; color: rgb(43, 145, 175);">in v1.x it&#39;s:</span></p>
<p><span style="font-size: 10pt; color: rgb(43, 145, 175);">&nbsp;</span></p>
<p><span style="font-size: 10pt; color: rgb(43, 145, 175);">import clr</span></p>
<p><span style="font-size: 10pt; color: rgb(43, 145, 175);">clr.AddReference(&#39;IronPython&#39;)</span></p>
<p><span style="font-size: 10pt; color: rgb(43, 145, 175);">from IronPython.Runtime.Exceptions import PythonKeyboardInterruptException</span></p>
<p><span style="font-size: 10pt; color: rgb(43, 145, 175);">main.Abort(PythonKeyboardInterruptException(&quot;&quot;))</span></p>
<p><span style="font-size: 10pt; color: rgb(43, 145, 175);">&nbsp;</span></p>
<p><span style="font-size: 11pt; color: rgb(31, 73, 125);">and then the user can catch it as a they&#39;d catch a normal keyboard interrupt.&nbsp; I think the only reason we don&#39;t have this implemented by default is that in some situations (
e.g. outside the console) we won&#39;t actually know what the &quot;main&quot; thread is.</span></p>
<p><span style="font-size: 11pt; color: rgb(31, 73, 125);">&nbsp;</span></p>
<div style="border-style: solid none none; border-color: rgb(181, 196, 223) -moz-use-text-color -moz-use-text-color; border-width: 1pt medium medium; padding: 3pt 0in 0in;">
<p><b><span style="font-size: 10pt;">From:</span></b><span style="font-size: 10pt;"> <a href="mailto:users-bounces@lists.ironpython.com" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">users-bounces@lists.ironpython.com
</a> [mailto:<a href="mailto:users-bounces@lists.ironpython.com" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">users-bounces@lists.ironpython.com</a>] <b>On Behalf Of </b>Curt Hagenlocher<br><b>Sent:
</b> Friday, October 19, 2007 10:17 AM<br><b>To:</b> Discussion of IronPython<br><b>Subject:</b> Re: [IronPython] thread.interrupt_main() not implemented</span></p></div>
<div><span>
<p>&nbsp;</p>
<div>
<p>thread.interrupt_main has somewhat different semantics than Thread.Abort; it basically triggers a keyboard interrupt on the main thread -- this is, of course, an exception that can be caught and handled by user code on that thread. 
</p></div>
<div>
<p>&nbsp;</p></div>
<div>
<p><span>On 10/19/07, <b>Dino Viehland</b> &lt;<a href="mailto:dinov@exchange.microsoft.com" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">dinov@exchange.microsoft.com</a>&gt; wrote:</span></p></div>


<div>
<blockquote style="border-style: none none none solid; border-color: -moz-use-text-color -moz-use-text-color -moz-use-text-color rgb(204, 204, 204); border-width: medium medium medium 1pt; padding: 0in 0in 0in 6pt; margin-left: 4.8pt; margin-right: 0in;">


<div>
<div>
<p><span style="font-size: 11pt; color: rgb(31, 73, 125);">I think you could work around this by remembering the main .NET thread and calling Abort on it:</span></p>
<p><span style="font-size: 11pt; color: rgb(31, 73, 125);">&nbsp;</span></p>
<p><span style="font-size: 11pt; color: rgb(31, 73, 125);">from System import Threading</span></p>
<p><span style="font-size: 11pt; color: rgb(31, 73, 125);">main = Thread.CurrentThread</span></p>
<p><span style="font-size: 11pt; color: rgb(31, 73, 125);">&nbsp;</span></p>
<p><span style="font-size: 11pt; color: rgb(31, 73, 125);"># and then later on…</span></p>
<p><span style="font-size: 11pt; color: rgb(31, 73, 125);">&nbsp;</span></p>
<p><span style="font-size: 11pt; color: rgb(31, 73, 125);">main.Abort()</span></p>
<p><span style="font-size: 11pt; color: rgb(31, 73, 125);">&nbsp;</span></p>
<p><span style="font-size: 11pt; color: rgb(31, 73, 125);">But I&#39;d suggest that interrupting a thread at an arbitrary point is a little dangerous (as it may have some state which isn&#39;t entirely consistent that it&#39;s trying to update). 
</span></p>
<p><span style="font-size: 11pt; color: rgb(31, 73, 125);">&nbsp;</span></p>
<p><span style="font-size: 11pt; color: rgb(31, 73, 125);">&nbsp;</span></p>
<div style="border-style: solid none none; border-color: rgb(181, 196, 223) -moz-use-text-color -moz-use-text-color; border-width: 1pt medium medium; padding: 3pt 0in 0in;">
<p><b><span style="font-size: 10pt;">From:</span></b><span style="font-size: 10pt;"> <a href="mailto:users-bounces@lists.ironpython.com" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">users-bounces@lists.ironpython.com 
</a>[mailto:<a href="mailto:users-bounces@lists.ironpython.com" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">users-bounces@lists.ironpython.com</a>] <b>On Behalf Of </b>Clems no<br><b>Sent:</b> Friday, October 19, 2007 8:37 AM 
<br><b>To:</b> <a href="mailto:users@lists.ironpython.com" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">users@lists.ironpython.com</a><br><b>Subject:</b> [IronPython] thread.interrupt_main() not implemented 
</span></p></div>
<p>&nbsp;</p>
<p style="margin-bottom: 12pt;">Hello,<br><br>When i want to use thread.interrupt_main() in iron python script, i&#39;ve got this error:<br>&nbsp;&nbsp; NotImplementedError: interrupt_main not implemented<br><br>Is there an equivalent in ironpython? 
<br><br>Thanks, <br><br>cbr.</p></div></div>
<p style="margin-bottom: 12pt;"><br>_______________________________________________<br>Users mailing list<br><a href="mailto:Users@lists.ironpython.com" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">

Users@lists.ironpython.com </a><br><a href="http://lists.ironpython.com/listinfo.cgi/users-ironpython.com" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">http://lists.ironpython.com/listinfo.cgi/users-ironpython.com
</a></p></blockquote></div>
<p>&nbsp;</p></span></div></div></div><br>_______________________________________________<br>Users mailing list<br><a href="mailto:Users@lists.ironpython.com" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">
Users@lists.ironpython.com
</a><br><a href="http://lists.ironpython.com/listinfo.cgi/users-ironpython.com" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">http://lists.ironpython.com/listinfo.cgi/users-ironpython.com</a><br>
<br>
</blockquote></div><br>
</span></div><br>_______________________________________________<br>Users mailing list<br><a onclick="return top.js.OpenExtLink(window,event,this)" href="mailto:Users@lists.ironpython.com">Users@lists.ironpython.com</a><br>
<a onclick="return top.js.OpenExtLink(window,event,this)" href="http://lists.ironpython.com/listinfo.cgi/users-ironpython.com" target="_blank">http://lists.ironpython.com/listinfo.cgi/users-ironpython.com</a><br><br></blockquote>
</div><br>