[Fxruby-users] [Q] addInput events eating all cpu
Status: Inactive
Brought to you by:
lyle
From: Laurent J. <Lau...@xr...> - 2004-09-30 10:01:16
|
Here's the problem I am having in FreeRIDE (FOX 1.0): I use an addInput to listen to a file descriptor which happens to be the STDOUT of a remote process. I use INPUT_READ on this channel to capture the incoming text and display it in a FXText object. The problem I have is when the remote process generate output at full speed, I can't get the FXText object to refresh and draw the line of text in a continuous way instead of displaying almost everything in one go when the remote process finally stop. Is there a way to solve this problem? Like giving some cycles to the "normal" update events that will refresh the FXText widget. Any idea is welcome Here is the piece of code that I use for monitoring the file descriptor: def attach_stdout(fh) getApp().addInput(fh, INPUT_READ|INPUT_EXCEPT) do |sender, sel, ptr| case SELTYPE(sel) when SEL_IO_READ begin text = fh.sysread(100000) print_stdout(text) # print the text in the FXText widget rescue EOFError detach_stdout(fh) end when SEL_IO_EXCEPT puts 'onPipeExcept' end end end Laurent |