I believe stack size should be rounded up and not down.<div><br><br><div class="gmail_quote">On Sun, Apr 24, 2011 at 6:40 AM, Jb Evain <span dir="ltr">&lt;<a href="mailto:jbevain@gmail.com">jbevain@gmail.com</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">Hi,<br>
<br>
On OS X, the following test crashes mono:<br>
<br>
using System;<br>
using System.Threading;<br>
<br>
class Program {<br>
<br>
        static void Main ()<br>
        {<br>
                const int system_page_size = 4096;<br>
                const int large_stacksize = system_page_size * 400;<br>
                const int undivisible_stacksize = 1048573;<br>
<br>
                var t1 = new Thread (new ThreadStart (delegate { Console.WriteLine<br>
(&quot;t1&quot;); }), undivisible_stacksize);<br>
                var t2 = new Thread (new ThreadStart (delegate { Console.WriteLine<br>
(&quot;t2&quot;); }), large_stacksize);<br>
<br>
                t1.Start ();<br>
                t2.Start ();<br>
<br>
                t1.Join ();<br>
                t2.Join ();<br>
        }<br>
}<br>
&lt;&lt;&lt;&lt;&lt;&lt;<br>
<br>
The issue being the invalid stacksize we eventually pass to<br>
pthread_attr_setstacksize.<br>
<br>
The attached patch fixes the issue and implements the behavior<br>
described in the MSDN for Thread::.ctor.<br>
<br>
Comments?<br>
<font color="#888888"><br>
Jb<br>
</font><br>_______________________________________________<br>
Mono-devel-list mailing list<br>
<a href="mailto:Mono-devel-list@lists.ximian.com">Mono-devel-list@lists.ximian.com</a><br>
<a href="http://lists.ximian.com/mailman/listinfo/mono-devel-list" target="_blank">http://lists.ximian.com/mailman/listinfo/mono-devel-list</a><br>
<br></blockquote></div><br></div>