[Mono-dev] Different behavior on Thread(ThreadEntryPoint, maxStackSize) on .net and mono?

Torello Querci tquerci at gmail.com
Wed Jul 7 10:13:38 EDT 2010


Hi guys,

I'm testing an the behavior of Thread class on mono and VS2005.
In the documentation page of MS it's specify that is maxStackSize is
less of 128KB an ArgumentOutOfRangeException it's raised.

This seems not to be true.

Using this code I try to change the maxStackSize value and wait to get
the exception.
Seems that using any value between 0 and 262144 (256k) I get the same
behavior on windows.

I suppose that it's better is the behavior it's the same, not if mono
respect the official documentation and .net not  :)

If you prefer I will fill a bug report.


Best Regards

===============================================================================

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;

namespace testThread
{
    class Program
    {
        static void Main(string[] args)
        {
            Program p = new Program();

            Thread t = new Thread(p.ThreadEntryPoint, Int32.Parse(args[0]));
            t.Start();
            Console.WriteLine("T0 - Chk1");
            Thread.Sleep(5000);
            Console.WriteLine("T0 - Exit");
        }

        public void ThreadEntryPoint(Object obj)
        {
            int i;
            if (obj == null)
            {
                Console.WriteLine("T1 - Chk1");
                i = 32000;
            }
            else
            {
                i = (int)obj - 1;
            }

            if (i > 0)
            {
                Console.WriteLine("I=" + i);
                ThreadEntryPoint(i);
            }
            else
            {
                Console.WriteLine("T1 - Exit");
            }
        }
    }
}


More information about the Mono-devel-list mailing list