From: Patrik Sundberg Date: 2002-02-17T00:48:34+09:00 Subject: Re: Ruby threading and GUI toolkits On Sun, Feb 17, 2002 at 12:17:35AM +0900, Rich Kilmer wrote: > I've encountered a bit of a dilemma. I need to have a GUI application with > background threads handling communications (tcp, etc). With the GUI > toolkits I have seen you set them up (build windows/widgets) then you enter > a message loop, and it locks the whole Ruby process (all other Ruby threads > are "starved"). I know Lyle has something that lets this work on Fox (kind > of...1.7 issues) but I was just wondering if anyone had any experience with > allowing this GUI message loop to NOT lock up Ruby threads? Are there any > general strategies we could use to enable this across all of the GUI > toolkits? other threads aren't blocked in at least FOX and Gtk. They are allowed to run in the toolkits idle-time as an idle function kind of (when gui idle -> call the idle function which let's other ruby-threads run for a while. This way you don't get maximum performance or flexibility but at least you are able to write multi-threaded applications. To avoid this we would have to let the GUI work in the ruby idle-time and have a ruby mail-loop - this probably isn't an option most of the time, don't really know. I think MetaRuby's mainloop would be usable in those cases though, like matju is using it for his all-ruby gui-toolkit based on his ruby-x11. -- ---------------------------------------------------------------------------. Patrik Sundberg Address: Rydsv�gen 100C, 584 31 Link�ping, Sweden | Email: ps@raditex.se || ps@radiac.mine.nu | Phone: +46 13 178567 || +46 707 602240 | .---> Applied Physics and Electrical Engineering student | |-----> Master of Science in Business Administration and Economics student | |-------> UNIX/Programming consultant | `--------------------------------------------------------------------------'