[fxruby-users] Updating GUI while doing slow IO-operations

Lyle Johnson lyle at lylejohnson.name
Fri Sep 21 11:08:02 EDT 2007


On Sep 20, 2007, at 1:59 AM, Kenneth Juul wrote:

> I have made a rather large program in Ruby for use in Windows. The
> user interface is made with fxruby, of course. The program is
> "talking" to a small embedded computer over both serial and ethernet
> interfaces. Some of this communication is taking a while, several
> minutes actually, and this is when my problem occurs:
>
> During slow, time consuming operations, the GUI freezes / hangs.
> Sometimes it just turn "windows-white" and stays like this until the
> IO is done, other times it just freezes the last window until IO is
> done.
>
> I have done some vague attempts on starting of the IO withing separate
> threads without any improvement. I also have tried some calls to
> flush(), forceRefresh(), refresh(), update() and so on, without any
> improvement.
>
> Enlighten me please!

The problem with using Ruby threads for the I/O is that they'll block  
the whole application. You might be able to use the FXApp#addInput  
API (see the input.rb example program), although I've never tried to  
use it with network I/O.


More information about the fxruby-users mailing list