[Gtk-sharp-list] Threading problem on Windows

D. Dobrev dpldobrev at yahoo.com
Mon Dec 1 16:54:54 EST 2008


Hello.
I have the following code: 
protected virtual void OnButtonOneDieClicked(object sender, EventArgs e)
	{
		if (this.isDieRolling)
		{
			this.isDieRolling = false;
		}
		else
		{
			this.isDieRolling = true;
			Thread thread = new Thread(() =>
			                           {
			                           		while (this.isDieRolling)
			                           		{
			                           			Thread.Sleep(1);
			                           			Application.Invoke((image, args) =>
			                           							   {
			                           		                   		
this.imageOneDie.Pixbuf = this.RollDie();
			                           							   });
			                           		}
			                           });
			thread.Start();
		}
	}

Its purpose is: when the button is first clicked, a few pictures (the sides
of a die) begin rapidly changing. The second click stops the changes (this
simulates the rolling of a die). In Linux this works perfectly, but in
Windows the rolling rate is variable: it begins fast, then it slows down,
then again fast, etc., with random intervals. Does anyone have an idea what
the problem might be? If this helps, the source of my application can be
found attached at the bottom of my 
http://www.nabble.com/forum/ViewPost.jtp?post=20758097&framed=y previous
thread .
-- 
View this message in context: http://www.nabble.com/Threading-problem-on-Windows-tp20781412p20781412.html
Sent from the Mono - Gtk# mailing list archive at Nabble.com.



More information about the Gtk-sharp-list mailing list