_why,

Im pretty impressed with shoes, it does threading so much better than
wxruby, see this sample

Shoes.app :width => 300, :height => 150 do

  $p = para "i == 0"
  $i = 0

  t = Thread.new do
    while true
      $i += 1
      sleep 0.001
      $p.replace "i == #{$i}"
    end
  end

end

It just works no mucking around with timers.

But ... Im stuck with wxruby for the time being, I think I may be able to
get this going with IO.popen, by having a background process that does all
the background stuff.

I am using drb which spawns background threads on demand for its
communications. wxruby is unfriendly to background threads.
http://rubyforge.org/pipermail/wxruby-users/2007-April/003047.html , this
means drb just hangs unless there is a timer triggering it somehow. Its
funny when debugging this, I had 1 app sending drb messages to my UI and it
would just hang, messages started going through when my mouse moved over the
ui and it hangs again when the movement stops (this can be alleviated a bit
with a timer but its still way too slow with the timer) shoes gives
background threads some time to do there stuff regardless. which is awsome.

wxruby does have timers, but I do not think I can get them to work fast
enough to have a smooth UI experience. If I start stealing 5/10ms from the
UI thread on a regular basis the UI will start fealing jerky.  If the popen
stuff works Ill just stick with that for now.

Cheers
Sam





On Tue, May 27, 2008 at 2:57 PM, _why <[EMAIL PROTECTED]> wrote:

> On Tue, May 27, 2008 at 12:52:01PM +1000, Sam Saffron wrote:
> > But then I realised there is a huge issue with most mri based guis
> > frameworks for ruby, threading. My architecture for my logviewer is: pump
> > all of the log messages over drb to the logviewer, on the logviewer app
> > chuck the data into a sqlite db and then pull in the info required from
> the
> > db to display screens of data. So, I need a background thread to load the
> > data into my sqlite db, and I dont want it to interfere/clash with the ui
> > thread.
>
> I'd recommend using a timer (like you'd do in JavaScript).  Maybe
> cut up your queries so they don't block the UI long and use a timer
> to load sections at a time?  I know wxWidgets itself has a timer.
>
> _why
>

Reply via email to