[Mono-list] Console.Write does not lock the console while writting.

Rohit rohits79@yahoo.com
Thu, 6 Nov 2003 03:32:22 -0800 (PST)


When I try the same program on mono 0.26+linux it
seems that the console is not locked in the callme
function while executing System.Console.WriteLine
(unlike in windows) and the behaviour is totally
different in the two worlds.
 

using System;
using System.Threading;

class someclass
{
            public string str;
            public void callme()
            {
                        for(;;)
System.Console.WriteLine(str);
            }
}

 

class mainclass
{
            public static void Main()
            {
                        someclass obj= new
someclass();
                        obj.str="a";
                        ThreadStart ts= new
ThreadStart(obj.callme);
                        Thread workerthread = new
Thread(ts);
                        workerthread.Start();
                       
System.Console.WriteLine("Press any key to suspend");
                        System.Console.ReadLine();
                        workerthread.Suspend();
                       
System.Console.WriteLine("Press any key to
resume");//This never gets printed
on windows
                        System.Console.ReadLine();   

                        workerthread.Resume();

            }

}


__________________________________
Do you Yahoo!?
Protect your identity with Yahoo! Mail AddressGuard
http://antispam.yahoo.com/whatsnewfree