[Mono-list] Re: [Gtk-sharp-list] ThreadNotify (A bug in Queue.Dequeue method)

Pablo Baena pbaena@uol.com.ar
12 Oct 2002 02:45:45 +0000


The last problem I showed here is not ThreadNotify's fault. Seems to be
a bug in Queue.Dequeue. 
If you look at the output of the test, you will notice it isn't accurate
to the data in the queue when you use Dequeue, but the commented part
with foreach works fine. 

Thank you! 
Pablo 


namespace test
{
	using System;
	using System.IO;
	using System.Runtime.InteropServices;
	using System.Diagnostics;
	using System.Collections;
	
	class test
	{
		public static void Main(string[] args)
		{
			Queue queue = new Queue();
			ProcessStartInfo psi = new ProcessStartInfo();
			psi.FileName="ls";
			psi.Arguments="/usr/doc";
			psi.WorkingDirectory="/tmp/";
			psi.RedirectStandardOutput=true;
			Process p = Process.Start(psi);
			string tmp;
			while ((tmp = p.StandardOutput.ReadLine())!=null) {
				Console.WriteLine("sending: "+tmp);
				queue.Enqueue(tmp);
			}

			/*
			foreach ( System.Object item in queue ) {
				Console.WriteLine("showing: {0}",item);
			}
			*/
			while(queue.Count>0){
				tmp = (string) queue.Dequeue();
				Console.WriteLine("showing: {0}",tmp);	
			}
		}
	}
}



On Fri, 2002-10-11 at 03:12, Pablo Baena wrote: 
    Tried this with gtk-sharp from CVS, doesn't seem to work neither. Am
    I doing it correctly? I think those lock statements are unnecesary
    though. 
    


________________________________________________________________________

<Tetsuo> la vida es muy ironica vio?
<Ranma> sip la verdad que se nos esta cagando de risa!
<Ranma> y la voy a cagar a piņas