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

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


--=-5uLs+Rv9lA3r/grD9x7H
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable

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;
=09
	class test
	{
		public static void Main(string[] args)
		{
			Queue queue =3D new Queue();
			ProcessStartInfo psi =3D new ProcessStartInfo();
			psi.FileName=3D"ls";
			psi.Arguments=3D"/usr/doc";
			psi.WorkingDirectory=3D"/tmp/";
			psi.RedirectStandardOutput=3Dtrue;
			Process p =3D Process.Start(psi);
			string tmp;
			while ((tmp =3D p.StandardOutput.ReadLine())!=3Dnull) {
				Console.WriteLine("sending: "+tmp);
				queue.Enqueue(tmp);
			}

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


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.=20
   =20



________________________________________________________________________


<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=F1as

--=-5uLs+Rv9lA3r/grD9x7H
Content-Type: text/html; charset=utf-8

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 TRANSITIONAL//EN">
<HTML>
<HEAD>
  <META HTTP-EQUIV="Content-Type" CONTENT="text/html; CHARSET=UTF-8">
  <META NAME="GENERATOR" CONTENT="GtkHTML/1.0.4">
</HEAD>
<BODY>
The last problem I showed here is not ThreadNotify's fault. Seems to be a bug in Queue.Dequeue.
<BR>
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.
<BR>

<BR>
Thank you!
<BR>
Pablo
<PRE>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=&quot;ls&quot;;
			psi.Arguments=&quot;/usr/doc&quot;;
			psi.WorkingDirectory=&quot;/tmp/&quot;;
			psi.RedirectStandardOutput=true;
			Process p = Process.Start(psi);
			string tmp;
			while ((tmp = p.StandardOutput.ReadLine())!=null) {
				Console.WriteLine(&quot;sending: &quot;+tmp);
				queue.Enqueue(tmp);
			}

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

<BR>
On Fri, 2002-10-11 at 03:12, Pablo Baena wrote:
    <BLOCKQUOTE>
    <FONT COLOR="#737373"><FONT SIZE="3"><I>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. </FONT></FONT></I>
    <BR>
    <FONT COLOR="#737373"><FONT SIZE="3"><I></FONT></FONT></I>
    </BLOCKQUOTE>
<TABLE CELLSPACING="0" CELLPADDING="0" WIDTH="100%">
<TR>
<TD>

<BR>

<HR>

<BR>

<PRE>&lt;Tetsuo&gt; la vida es muy ironica vio?
&lt;Ranma&gt; sip la verdad que se nos esta cagando de risa!
&lt;Ranma&gt; y la voy a cagar a pi&#241;as</PRE>
</TD>
</TR>
</TABLE>

</BODY>
</HTML>

--=-5uLs+Rv9lA3r/grD9x7H--