|
From: | Jonathan Wilson |
Subject: | Re: change to gtk-1.2/threads.scm |
Date: | Mon, 03 Jul 2006 11:13:15 -0500 |
User-agent: | Thunderbird 1.5.0.4 (X11/20060516) |
Hi Kevin, thanks for your response! Kevin Ryde wrote:
Please post a failing sample program if you can.
I can probably do this tonight when I get home.
(while #t (if (gtk-events-pending) (gtk-main-iteration) (yield))))That's meant to be unnecessary, the glib threads hooks stuff is supposed to be initialized so the "select"s within gtk-main (etc) will cooperate with the guile threading.
I've been looking at the gtk+-1.2 and glib source. gtk_main() calls g_main_run(loop), which calls g_main_iterate(TRUE,TRUE). The first argument is called "block". I take this to mean that if it is true, the thread will block when there is no input. So, I think we need to leave guile mode whenever we call gtk_main, so that blocking doesn't screw up guile. From the 1.8 guile manual (I am using guile 1.8, btw):
Consequently, when a thread in guile mode blocks and does no longer frequent safe points, it might cause all other guile mode threads to block as well. To prevent this from happening, a guile mode thread should either only block in libguile functions (who know how to do it right), or should temporarily leave guile mode with scm_without_guile.
So it seems that we either must leave guile mode to run the gtk event loop, or else run it in such a way that it does not block ever.
I suppose that we'd have to wrap all callbacks to scheme function in scm_with_guile or something.
Regards, Jon
[Prev in Thread] | Current Thread | [Next in Thread] |