[#1215] Tk widget demo; English Tk docs?; Java 1.2 Swing — "Conrad Schneiker" <schneiker@...>
Hi,
[#1218] Trivial FAQ bug — Dave Thomas <Dave@...>
[#1229] A vote for old behavior — Dave Thomas <Dave@...>
[#1232] Any FAQ requests, updates, ... — Dave Thomas <Dave@...>
[#1233] Singleton classes — Dave Thomas <Dave@...>
[#1263] Draft of the updated Ruby FAQ — Dave Thomas <Dave@...>
[#1307] Ruby/GTK 0.23 released — Hiroshi IGARASHI <igarashi@...>
Hi all,
From: Hiroshi IGARASHI <igarashi@ueda.info.waseda.ac.jp>
From: "Conrad Schneiker" <schneiker@jump.net>
On Fri, Feb 18, 2000 at 09:37:27PM -0500, Yasushi Shoji wrote:
[#1322] FAQ: Ruby acronyms — "Conrad Schneiker" <schneiker@...>
In the spirit of TABWTDI (there are better ways to do it), I'd like to
[#1341] Vim syntax file — Mirko Nasato <mirko.nasato@...>
Hi,
On Mon, Feb 14, 2000 at 05:44:39PM +0100, Mirko Nasato wrote:
[#1354] Say hi (bis) — Pixel <pixel_@...>
hi all,
[#1355] nice sample for functional stuff — Pixel <pixel_@...>
what about having map in standard (and map_index too)?
[#1373] Ruby Language Reference Manual--Glossary — "Conrad Schneiker" <schneiker@...>
I was going to print the Ruby Language Reference Manual when I noticed that
[#1376] Re: Scripting versus programming — Andrew Hunt <andy@...>
Conrad writes:
[#1379] Re: Yield — Andrew Hunt <andy@...>
>From: "Conrad Schneiker" <schneiker@jump.net>
[#1384] Re: Say Hi — mengx@...
My suggestion was to try to find a more comfortable method name (to me, and
[#1392] Re: Some Questions - Parameterised Types / Invariants — Andrew Hunt <andy@...>
>1. Parameterised Types / Template Classes
[#1398] Bignum aset — Andrew Hunt <Andy@...>
[#1488] Discussion happens on news.groups — Clemens Hintze <c.hintze@...>
Hi,
[#1508] Ruby/GTK and the mainloop — Ian Main <imain@...>
Hello Ian,
On Wed, Feb 23, 2000 at 02:56:10AM -0500, Yasushi Shoji wrote:
[#1516] Ruby: PLEASE use comp.lang.misc for all Ruby programming/technical questions/discussions!!!! — "Conrad Schneiker" <schneiker@...>
((FYI: This was sent to the Ruby mail list.))
From: "Conrad Schneiker" <schneiker@jump.net>
[#1528] ruby <=> python — Quinn Dunkan <quinn@...>
Hello! I'm new to ruby-talk, and mostly new to ruby. I'm making a document
[#1551] Ruby thread scheduling buglet — Ian Main <imain@...>
[#1569] Re: Ruby: constructors, new and initialise — Yukihiro Matsumoto <matz@...>
The following message is a courtesy copy of an article
[#1591] Certain char's not recognized by "." in regex? — Wes Nakamura <wknaka@...>
[#1592] Race condition in Singleton — Dave Thomas <Dave@...>
[ruby-talk:01560] Re: Ruby/GTK and the mainloop
On Thu, Feb 24, 2000 at 04:47:18PM +0900, Yukihiro Matsumoto wrote:
> Hi,
>
> In message "[ruby-talk:01550] Re: Ruby/GTK and the mainloop"
> on 00/02/23, Ian Main <imain@gtk.org> writes:
>
> |Yes, what I did was change the idle () function:
> |
> |static gint
> |idle()
> |{
> | struct timeval wait;
> |
> | wait.tv_sec = 0;
> | wait.tv_usec = 1000; /* 100ms */
> |
> | CHECK_INTS;
> | if (!rb_thread_critical) rb_thread_wait_for(wait);
> |
> | return Qtrue;
> |}
> |
> |If I am correct, what ends up happening in rb_thread_wait_for (), is that it
> |calls thread_schedule with a timeout of (in this case) 100ms. If there are
> |no other active threads, it sits in select for 100ms, and then returns to
> |give gtk a chance to run. Changing the above to 10ms, means that gtk gets
> |control back faster (so long as no other ruby threads are running).
>
> Since you don't need to run idle function when there's only one
> thread, you may use rb_thread_alone() to check threads. It returns
> true if there is only one thread (main_thread).
Hmm, yes, this could improve matters.
> |GTK has good facilities for this.. from looking through ruby source code
> |again, it looks like ruby needs only:
> |
> |* The ability to watch file descriptors for read/write readiness.
> |* A timeout for sleep() and similar functions.
> |
> |What we can do is extrapolate that in the ruby core, so that when ruby needs
> |these facilities, it calls a specific function in ruby. We then set it up
> |so that in the end these use function pointers, defaulting to the native
> |ruby versions. A function in ruby could then allow us to override these
> |functions inside ruby, and in the case of the gtk bindings, they would
> |provide ruby-compatible wrappers around gdk_input_add (), and
> |gtk_timeout_add ().
>
> Hmm, I have to participate in this discussion bit more seriously if
> core modification needed. :-)
>
> I haven't get the picture well yet. Two features above can solve the
> slow gtk problem? Technically speaking, those features are fairly
> easy to implement, except we need to decide *good* API beforehand.
Yes, and I am glad to see you are interested, and want a good api :) I
would be happy to work with you on this.
> |Yes, that's exactly why. GTK is only getting a chance to refresh the screen
> |every 100ms, which is noticible when scrolling, or typing etc.
>
> Gtk's idle() function called too often. How about using
> gtk_add_timeout() again, like before? What was the problem?
gtk_add_timeout () combined with rb_thread_alone () would probably be an
improvement. The overall issue, is that you have 2 peices in a gtk/ruby
program, both of which usually assume they have complete control. So what
you end up having to do is allow one to assume control, and then poll for
events (or runnable threads) in the other.
I personally don't like polling, so I'm trying to think of a way around
this.
With my perusal of the thread code today, I almost have my head around it
all.. there's still a few issues I need to figure out with respect to
extrapolating the main loop, so I'll look into resolving that in the next
few days.
Thanks,
Ian
>
> matz.