[Mono-dev] [patch] Fix crash for invalid stack size on os x

Rodrigo Kumpera kumpera at gmail.com
Sun Apr 24 15:31:14 EDT 2011


I believe stack size should be rounded up and not down.


On Sun, Apr 24, 2011 at 6:40 AM, Jb Evain <jbevain at gmail.com> wrote:

> Hi,
>
> On OS X, the following test crashes mono:
>
> using System;
> using System.Threading;
>
> class Program {
>
>        static void Main ()
>        {
>                const int system_page_size = 4096;
>                const int large_stacksize = system_page_size * 400;
>                const int undivisible_stacksize = 1048573;
>
>                var t1 = new Thread (new ThreadStart (delegate {
> Console.WriteLine
> ("t1"); }), undivisible_stacksize);
>                var t2 = new Thread (new ThreadStart (delegate {
> Console.WriteLine
> ("t2"); }), large_stacksize);
>
>                t1.Start ();
>                t2.Start ();
>
>                t1.Join ();
>                t2.Join ();
>        }
> }
> <<<<<<
>
> The issue being the invalid stacksize we eventually pass to
> pthread_attr_setstacksize.
>
> The attached patch fixes the issue and implements the behavior
> described in the MSDN for Thread::.ctor.
>
> Comments?
>
> Jb
>
> _______________________________________________
> Mono-devel-list mailing list
> Mono-devel-list at lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/mono-devel-list
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.ximian.com/pipermail/mono-devel-list/attachments/20110424/8bd8198a/attachment-0001.html 


More information about the Mono-devel-list mailing list