From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Andy Wingo Newsgroups: gmane.lisp.guile.user Subject: Re: Guile threads vs GTK loop Date: Sun, 15 Aug 2004 11:53:16 +0100 Sender: guile-user-bounces+guile-user=m.gmane.org@gnu.org Message-ID: <20040815105316.GF27040@lark> References: <20040731112623.GA21776@feanor> NNTP-Posting-Host: deer.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Trace: sea.gmane.org 1092578488 29339 80.91.224.253 (15 Aug 2004 14:01:28 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Sun, 15 Aug 2004 14:01:28 +0000 (UTC) Original-X-From: guile-user-bounces+guile-user=m.gmane.org@gnu.org Sun Aug 15 16:01:23 2004 Return-path: Original-Received: from lists.gnu.org ([199.232.76.165]) by deer.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 1BwLZb-0004TQ-00 for ; Sun, 15 Aug 2004 16:01:23 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.33) id 1BwLde-0006At-Mz for guile-user@m.gmane.org; Sun, 15 Aug 2004 10:05:34 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.33) id 1BwLdY-00065g-IL for guile-user@gnu.org; Sun, 15 Aug 2004 10:05:28 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.33) id 1BwLdX-00064f-Ns for guile-user@gnu.org; Sun, 15 Aug 2004 10:05:28 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.33) id 1BwLdX-00064O-FR for guile-user@gnu.org; Sun, 15 Aug 2004 10:05:27 -0400 Original-Received: from [216.166.232.203] (helo=johnson-resources.com) by monty-python.gnu.org with esmtp (TLSv1:DES-CBC3-SHA:168) (Exim 4.34) id 1BwLZ9-0002rW-Q5 for guile-user@gnu.org; Sun, 15 Aug 2004 10:00:55 -0400 Original-Received: from localhost (mantis.schoolnet.na [::ffff:196.44.140.238]) (AUTH: LOGIN wingo) by johnson-resources.com with esmtp; Sun, 15 Aug 2004 10:00:56 -0400 id 001201C3.411F6C99.00007B52 Original-Received: from wingo by localhost with local (Exim 3.36 #1 (Debian)) id 1BwIdt-0007C4-00 for ; Sun, 15 Aug 2004 11:53:37 +0100 Original-To: guile-user@gnu.org Mail-Followup-To: guile-user@gnu.org Content-Disposition: inline In-Reply-To: <20040731112623.GA21776@feanor> X-Operating-System: Linux lark 2.4.20-1-686 User-Agent: Mutt/1.5.6+20040803i X-BeenThere: guile-user@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: General Guile related discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guile-user-bounces+guile-user=m.gmane.org@gnu.org Xref: main.gmane.org gmane.lisp.guile.user:3387 X-Report-Spam: http://spam.gmane.org/gmane.lisp.guile.user:3387 Hey Ondrej, On Sat, 31 Jul 2004, Ondrej Zajicek wrote: > - How i can ask whether there are any running guile threads? > (To deinstall idle handler where there aren't any.) I think that single-active-thread?, although not documented, will do what you want. > - How i can be informed (some hook?) whether any new running guile thread > appeared? (To reinstall idle handler.) You'll have to write this layer yourself, I think. Is it really a big performance impact? I would avoid this complexity. Perhaps you know something I don't :) > - My Guile-exported C subroutines aren't reentrant. Is there a need to use any > locking? Happen guile thread switches even during call to C subroutines? "Do guile thread switches happen ..." :-) I don't think so. Thread switches can happen when threads are created, when mutices and signals are operated on, when scm_yield is called, when SCM_ALLOW_INTS is called, and when SCM_TICK is called. That's not an exhaustive list. SCM_TICK is called frequently by the evaluator, and is the result of most thread switches. [Corrolary: `yield' is called all the time, with little impact in the single-threaded case. Why bother with removing the idle handler? It should be a timeout handler, btw; unless you want it to eat all of the CPU.] So no, there is no signal that drives thread switches. I think that a call to a C subroutine would block the app. However, all of the above is just from reading the source; I personally haven't used threading in 1.6. Regards, -- Andy Wingo http://ambient.2y.net/wingo/ _______________________________________________ Guile-user mailing list Guile-user@gnu.org http://lists.gnu.org/mailman/listinfo/guile-user