<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:x="urn:schemas-microsoft-com:office:excel" xmlns:p="urn:schemas-microsoft-com:office:powerpoint" xmlns:a="urn:schemas-microsoft-com:office:access" xmlns:dt="uuid:C2F41010-65B3-11d1-A29F-00AA00C14882" xmlns:s="uuid:BDC6E3F0-6DA3-11d1-A2A3-00AA00C14882" xmlns:rs="urn:schemas-microsoft-com:rowset" xmlns:z="#RowsetSchema" xmlns:b="urn:schemas-microsoft-com:office:publisher" xmlns:ss="urn:schemas-microsoft-com:office:spreadsheet" xmlns:c="urn:schemas-microsoft-com:office:component:spreadsheet" xmlns:oa="urn:schemas-microsoft-com:office:activation" xmlns:html="http://www.w3.org/TR/REC-html40" xmlns:q="http://schemas.xmlsoap.org/soap/envelope/" xmlns:D="DAV:" xmlns:x2="http://schemas.microsoft.com/office/excel/2003/xml" xmlns:ois="http://schemas.microsoft.com/sharepoint/soap/ois/" xmlns:dir="http://schemas.microsoft.com/sharepoint/soap/directory/" xmlns:ds="http://www.w3.org/2000/09/xmldsig#" xmlns:dsp="http://schemas.microsoft.com/sharepoint/dsp" xmlns:udc="http://schemas.microsoft.com/data/udc" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:sub="http://schemas.microsoft.com/sharepoint/soap/2002/1/alerts/" xmlns:ec="http://www.w3.org/2001/04/xmlenc#" xmlns:sp="http://schemas.microsoft.com/sharepoint/" xmlns:sps="http://schemas.microsoft.com/sharepoint/soap/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:udcxf="http://schemas.microsoft.com/data/udc/xmlfile" xmlns:wf="http://schemas.microsoft.com/sharepoint/soap/workflow/" xmlns:mver="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns:mrels="http://schemas.openxmlformats.org/package/2006/relationships" xmlns:ex12t="http://schemas.microsoft.com/exchange/services/2006/types" xmlns:ex12m="http://schemas.microsoft.com/exchange/services/2006/messages" xmlns:Z="urn:schemas-microsoft-com:" xmlns="http://www.w3.org/TR/REC-html40">

<head>
<meta http-equiv=Content-Type content="text/html; charset=utf-8">
<meta name=Generator content="Microsoft Word 12 (filtered medium)">
<style>
<!--
 /* Font Definitions */
 @font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:Tahoma;
        panose-1:2 11 6 4 3 5 4 4 2 4;}
 /* Style Definitions */
 p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman","serif";}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
span.EmailStyle17
        {mso-style-type:personal-reply;
        font-family:"Calibri","sans-serif";
        color:#1F497D;}
.MsoChpDefault
        {mso-style-type:export-only;}
@page Section1
        {size:8.5in 11.0in;
        margin:1.0in 1.0in 1.0in 1.0in;}
div.Section1
        {page:Section1;}
-->
</style>
<!--[if gte mso 9]><xml>
 <o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
 <o:shapelayout v:ext="edit">
  <o:idmap v:ext="edit" data="1" />
 </o:shapelayout></xml><![endif]-->
</head>

<body lang=EN-US link=blue vlink=purple>

<div class=Section1>

<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'>Do signals work well with managed code? When a signal is raised,
the OS freezes whatever the thread was doing and runs the handler. <a
href="http://msdn.microsoft.com/en-us/library/xdkz3x12(VS.71).aspx">http://msdn.microsoft.com/en-us/library/xdkz3x12(VS.71).aspx</a>
lists a number of restrictions that the handler needs to follow. It does not
say anything about managed code specifically. But you are not supposed to use
heap routines, and running IronRuby code will almost definitely allocate
objects under the hood. Also, if the managed handler triggers a GC or a
stack-walk for some other reason, it could lead to problems if the thread was
originally in an uninterruptible state. <o:p></o:p></span></p>

<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'><o:p>&nbsp;</o:p></span></p>

<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'>Wayne, did Ruby.Net have good tests around Signal? I wonder if
Signal can actually be well supported in IronRuby, or if its going to be a
fragile API.<o:p></o:p></span></p>

<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'><o:p>&nbsp;</o:p></span></p>

<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'>The same problems would apply to MRI or other runtimes where the
user is not in full control of the actual processor instructions that get
executed as part of the handler. However, MRI is probably a simpler system than
the CLR and less susceptible to the kinds of problems mentioned above.<o:p></o:p></span></p>

<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'><o:p>&nbsp;</o:p></span></p>

<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'>We could support some of the well-known signals by mapping them
directly to .NET paradigms. SIGNINT can be handled by using Console.CancelKeyPress
(<a
href="http://msdn.microsoft.com/en-us/library/system.console.cancelkeypress.aspx">http://msdn.microsoft.com/en-us/library/system.console.cancelkeypress.aspx</a>).
SIGTERM can be built on top of AppDomain.ProcessExit (<a
href="http://msdn.microsoft.com/en-us/library/system.appdomain.processexit.aspx">http://msdn.microsoft.com/en-us/library/system.appdomain.processexit.aspx</a>)
or AppDomain.DomainUnload (<a
href="http://msdn.microsoft.com/en-us/library/system.appdomain.domainunload.aspx">http://msdn.microsoft.com/en-us/library/system.appdomain.domainunload.aspx</a>).
<o:p></o:p></span></p>

<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'><o:p>&nbsp;</o:p></span></p>

<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'>For other signals like USR1 and USR2, we can implement stub
functions for Signal#trap that does no real work. So Ruby code that calls
Signal#trap will not fail right away, and things will work as long as no one calls
Process.kill. IronRuby may end up not using fastcgi, and so we may not need all
of these handlers anyway. <o:p></o:p></span></p>

<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'><o:p>&nbsp;</o:p></span></p>

<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'>For RailsConf, I think we should just stub out Signal#trap, and
then later discuss a real plan for signals. John, Tomas, does this sound like a
reasonable plan?<o:p></o:p></span></p>

<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'><o:p>&nbsp;</o:p></span></p>

<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'>Thanks,<o:p></o:p></span></p>

<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'>Shri<o:p></o:p></span></p>

<p class=MsoNormal><span style='font-size:9.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'><a
href="http://blogs.msdn.com/ironpython/archive/2008/02/25/ironpython-ironruby-and-f-openings-in-dev-test-and-pm.aspx"><span
style='color:blue'>Want to work on IronPython, IronRuby, F#</span></a>? </span><span
style='font-size:1.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>Visit
http://blogs.msdn.com/ironpython/</span><span style='font-size:9.0pt;
font-family:"Calibri","sans-serif";color:#1F497D'><o:p></o:p></span></p>

<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'><o:p>&nbsp;</o:p></span></p>

<div style='border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0in 0in 0in'>

<p class=MsoNormal><b><span style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'>From:</span></b><span
style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'>
ironruby-core-bounces@rubyforge.org
[mailto:ironruby-core-bounces@rubyforge.org] <b>On Behalf Of </b>Ivan Porto
Carrero<br>
<b>Sent:</b> Sunday, May 18, 2008 5:39 PM<br>
<b>To:</b> ironruby-core@rubyforge.org<br>
<b>Subject:</b> Re: [Ironruby-core] Signal.trap<o:p></o:p></span></p>

</div>

<p class=MsoNormal><o:p>&nbsp;</o:p></p>

<p class=MsoNormal style='margin-bottom:12.0pt'>AFAICT they use<br>
<br>
INT, TERM, HUP, USR1, USR2 (most of them in the fastcgi handler, but mongrel
and thin use them as well)<br>
<br>
thin also uses QUIT<br>
<br>
That's what i got from quickly running grep over my rails gems<br>
I've asked koz if I left some out and if I did I'll let you know which ones are
missing.<br>
<br>
<o:p></o:p></p>

<div>

<p class=MsoNormal>On Mon, May 19, 2008 at 12:11 PM, Wayne Kelly &lt;<a
href="mailto:w.kelly@qut.edu.au">w.kelly@qut.edu.au</a>&gt; wrote:<o:p></o:p></p>

<p class=MsoNormal><br>
I'm not sure I can answer that question in it's totality as I'm not familiar
with much of the Rails framework. But the examples that I've seen so far have
been trapping the SIGINT and/or TERM signals in order to perform a graceful
controlled shutdown.<br>
<br>
Cheers, Wayne.<o:p></o:p></p>

<div>

<p class=MsoNormal><br>
<br>
&gt; -----Original Message-----<br>
&gt; From: <a href="mailto:ironruby-core-bounces@rubyforge.org">ironruby-core-bounces@rubyforge.org</a><br>
&gt; [mailto:<a href="mailto:ironruby-core-bounces@rubyforge.org">ironruby-core-bounces@rubyforge.org</a>]
On Behalf Of<o:p></o:p></p>

</div>

<div>

<div>

<p class=MsoNormal>&gt; Tomas Matousek<br>
&gt; Sent: Monday, 19 May 2008 10:00 AM<br>
&gt; To: <a href="mailto:ironruby-core@rubyforge.org">ironruby-core@rubyforge.org</a><br>
&gt; Subject: Re: [Ironruby-core] Signal.trap<br>
&gt;<br>
&gt; What signals are used in Rails and what for?<br>
&gt;<br>
&gt; Tomas<br>
&gt;<br>
&gt; -----Original Message-----<br>
&gt; From: <a href="mailto:ironruby-core-bounces@rubyforge.org">ironruby-core-bounces@rubyforge.org</a><br>
&gt; [mailto:<a href="mailto:ironruby-core-bounces@rubyforge.org">ironruby-core-bounces@rubyforge.org</a>]
On Behalf Of<br>
&gt; Sanghyeon Seo<br>
&gt; Sent: Sunday, May 18, 2008 9:32 AM<br>
&gt; To: <a href="mailto:ironruby-core@rubyforge.org">ironruby-core@rubyforge.org</a><br>
&gt; Subject: Re: [Ironruby-core] Signal.trap<br>
&gt;<br>
&gt; 2008/5/18 Michael Letterle &lt;<a href="mailto:michael.letterle@gmail.com">michael.letterle@gmail.com</a>&gt;:<br>
&gt; &gt; PInvokes would, of course, make it non-portable to mono...or<br>
&gt; &gt; silverlight for that matter. &nbsp;So no, I don't think it's a<br>
&gt; good idea :)<br>
&gt;<br>
&gt; Well, Mono supports P/Invoke, and Ruby.NET's Signal code<br>
&gt; actually worked fine on Mono. (In this case, signal()<br>
&gt; function is portable between Windows and Unix.)<br>
&gt;<br>
&gt; Silverlight would be problematic indeed. But then, why would<br>
&gt; Ruby code in Silverlight use methods in Signal module?<br>
&gt;<br>
&gt; --<br>
&gt; Seo Sanghyeon<br>
&gt; _______________________________________________<br>
&gt; Ironruby-core mailing list<br>
&gt; <a href="mailto:Ironruby-core@rubyforge.org">Ironruby-core@rubyforge.org</a><br>
&gt; <a href="http://rubyforge.org/mailman/listinfo/ironruby-core"
target="_blank">http://rubyforge.org/mailman/listinfo/ironruby-core</a><br>
&gt; _______________________________________________<br>
&gt; Ironruby-core mailing list<br>
&gt; <a href="mailto:Ironruby-core@rubyforge.org">Ironruby-core@rubyforge.org</a><br>
&gt; <a href="http://rubyforge.org/mailman/listinfo/ironruby-core"
target="_blank">http://rubyforge.org/mailman/listinfo/ironruby-core</a><br>
&gt;<br>
_______________________________________________<br>
Ironruby-core mailing list<br>
<a href="mailto:Ironruby-core@rubyforge.org">Ironruby-core@rubyforge.org</a><br>
<a href="http://rubyforge.org/mailman/listinfo/ironruby-core" target="_blank">http://rubyforge.org/mailman/listinfo/ironruby-core</a><o:p></o:p></p>

</div>

</div>

</div>

<p class=MsoNormal><o:p>&nbsp;</o:p></p>

</div>

</body>

</html>