Forum: Ruby-Gnome 2 Threading issues

Posted by Aiden Nibali (dismal_denizen)
on 2010-01-29 23:54
Hello everyone,

I am aware that there are many people who have asked questions relating
to multi-threaded Gtk applications. However, after much trawling through
the Internet I still can't work out why the following simple code will
not produce any output:

 require 'gtk2'

 Thread.new do
   sleep 1 # Look busy
   exit    # Finished, exit
 end

 # Main loop
 loop do
   # Process all currently pending events
   Gtk.main_iteration while Gtk.events_pending?
   print '.'
 end

It seems as if the sleeping thread is causing events to be fired,
because Gtk.events_pending? remains true the whole time. This doesn't
sound right, but I can't think of a better explanation for the code's
behaviour. The problem is that the UI will freeze while the other thread
is running (I found this out whilst using Gtk.main, but a custom loop
displays the issue more clearly).

My Gtk wizardry is quite limited, so I would appreciate any help :)


Thanks,
Aiden
Posted by Pascal Terjan (Guest)
on 2010-01-30 00:32
(Received via mailing list)
Le vendredi 29 janvier 2010 à 23:54 +0100, Aiden Nibali a écrit :
>    sleep 1 # Look busy
>    exit    # Finished, exit
>  end
> 
>  # Main loop
>  loop do
>    # Process all currently pending events
>    Gtk.main_iteration while Gtk.events_pending?
>    print '.'
>  end

It produces plenty of output here (fills my screen with dots immediatly)
Posted by Aiden Nibali (dismal_denizen)
on 2010-01-30 01:25
Pascal Terjan wrote:
> It produces plenty of output here (fills my screen with dots immediatly)

That's very strange. What is your environment like? I'm running Ruby 
1.8.7 on Ubuntu Karmic Koala (32-bit) with the Ruby Gtk bindings found 
in the repositories, and I get no output at all :(
Posted by Pascal Terjan (Guest)
on 2010-01-30 21:02
(Received via mailing list)
Le samedi 30 janvier 2010 à 01:25 +0100, Aiden Nibali a écrit :
> Pascal Terjan wrote:
> > It produces plenty of output here (fills my screen with dots immediatly)
> 
> That's very strange. What is your environment like? I'm running Ruby 
> 1.8.7 on Ubuntu Karmic Koala (32-bit) with the Ruby Gtk bindings found 
> in the repositories, and I get no output at all :(

See
http://sourceforge.net/mailarchive/forum.php?thread_name=dc3bf8581001120746kb5da118udd0a74439cc4dcd9%40mail.gmail.com&forum_name=ruby-gnome2-devel-en 
then, and teport it to launchpad to get the fix in Ubuntu
Posted by Aiden Nibali (dismal_denizen)
on 2010-01-30 22:56
Pascal Terjan wrote:
> See
> http://sourceforge.net/mailarchive/forum.php?thread_name=dc3bf8581001120746kb5da118udd0a74439cc4dcd9%40mail.gmail.com&forum_name=ruby-gnome2-devel-en 
> then, and teport it to launchpad to get the fix in Ubuntu

Thanks for the pointer. I have installed the latest version of ruby-gtk2 
now and it works perfectly, filling my screen with glorious dots. I have 
reported the bug at 
https://bugs.launchpad.net/ubuntu/+source/ruby-gnome2/+bug/514899.
Posted by Guillaume Cottenceau (Guest)
on 2010-01-31 19:08
(Received via mailing list)
> Thanks for the pointer. I have installed the latest version of ruby-gtk2
> now and it works perfectly, filling my screen with glorious dots. I have

Can you tell me how did you do that? Unless you've done it manually,
I'm interested in instructions for other users..

--
Guillaume Cottenceau - http://zarb.org/~gc/
Posted by Aiden Nibali (dismal_denizen)
on 2010-02-01 06:29
> Can you tell me how did you do that? Unless you've done it manually,
> I'm interested in instructions for other users..

Unfortunately I had to build ruby-gtk2 0.19.3 from source. However, it 
looks as if the problem will be solved in Ubuntu 10.4, as this is the 
version which will be used for that release :)
Please log in before posting. Registration is free and takes only a minute.
Existing account (Switch to SSL-encrypted connection)
NEW: Do you have a Google/GoogleMail or Yahoo account? No registration required!
Log in with Google account | Log in with Yahoo account
No account? Register here.