[Wxruby-users] wxruby unfriendly to other threads?

Alex Fenton alex at pressure.to
Sun Apr 29 14:17:48 EDT 2007


Alex Fenton wrote:
> That aside, however, I've tried on a few more platforms and am getting 
> inconsistent results using 'evt_idle { Thread.pass }'.
>   
Sorry to reply to my own post, but just to let you know that using 
Wx::Timer + Thread.pass + evt_timer inside App#on_init seems to work 
well on OS X (dev, not 0.0.39), GTK (both) and Windows (both).

def on_init
    t = Wx::Timer.new(self, 55)
    evt_timer(55) { Thread.pass }
    t.start(100)
    ...

A sleep(1) loop plus a 100ms timer runs every 1s to 1.1s, which is what 
I'd expect. This would be suitable for a background task; Wx::Timer 
alone would probably be better for a timed loop.

A quick search suggests that the ruby ports of QT, GTK and Fox all 
suffer the same problem and recommend a similar solution.

hth
a






More information about the wxruby-users mailing list