From: Ferenc Engard Date: 2002-09-01T02:17:20+09:00 Subject: Re: BUG: threads and ruby/tk Hello, > > Here is the code: > [snippits] > > -------------------------------- > > $count=TkVariable.new "start" > > t=Thread.new { > > loop { > > $count.value="blah" > > } > > } > > Tk.mainloop > > -------------------------------- > > Classic problem. > > You set Tk stuff from a second thread, where the mainloop expects to be > the only one doing so. In other words, race conditions. The result: > totally weird behaviour. I would be curious whether other toolkits suffer > from this, too. > > The solution is called TkAfter and I should probably write a chapter about > it in my tutorial. Yeah, the example helped a lot. Especially, my program was a graph-drawing program, where one loop lasted cca. 2.3 seconds with my thread-solution. Now it takes 0.08 seconds. :-)))) BIG difference... Thank you: Circum