[Mono-list] Segmentation fault !

Candide Kemmler candide@urbanium.tv
Wed, 17 Apr 2002 15:43:53 +0200


Hi,

This is the sequel of the Threading hello world program.

I've got a Segmentation Fault with the following program with the latest 
april 17 version of the baselabs rpms (got no Windows machine to build 
mcs). I've also recompiled the runtime by doing

cd mono
./autogen.sh
make
make install

Please could you confirm that these two steps will keep me up-to-date 
with the latest mono runtime (that is "latest from cvs"), i.e. that the 
baselabs rpm is compatible with building the mono runtime from the 
command line.

using System;
using System.Threading;

class Hello {
   public static void Main () {
     new MainThreadHandler ();	
   }
}

public class MainThreadHandler {
   public MainThreadHandler () {
     while ( true ) {
       Thread.Sleep ( 100 );
        WorkerThreadHandler myWorkerThreadHandler = new 
WorkerThreadHandler ();
       ThreadStart myThreadStart = new ThreadStart 
( myWorkerThreadHandler.HandleThread );
       Thread myWorkerThread = new Thread ( myThreadStart );
       myWorkerThread.Start ();
     }
   }
}

class WorkerThreadHandler {
   public void HandleThread () {
     Console.WriteLine ( "haha" );
   }
}

This program is stupid, I must admit it, but it shouldn't end on a 
segmentation fault after issuing "haha" about 10 times. Note that the 
number of times the "haha" string is issued varies.

Maybe I should leave you alone with the Threading stuff, looks rather 
unstable at this stage, right ?

Candide