From: Andy Wingo <wingo@pobox.com>
Subject: Re: Guile threads vs GTK loop
Date: Sun, 15 Aug 2004 11:53:16 +0100 [thread overview]
Message-ID: <20040815105316.GF27040@lark> (raw)
In-Reply-To: <20040731112623.GA21776@feanor>
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 <wingo@pobox.com>
http://ambient.2y.net/wingo/
_______________________________________________
Guile-user mailing list
Guile-user@gnu.org
http://lists.gnu.org/mailman/listinfo/guile-user
prev parent reply other threads:[~2004-08-15 10:53 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-07-31 11:26 Guile threads vs GTK loop Ondrej Zajicek
2004-08-15 10:53 ` Andy Wingo [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/guile/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20040815105316.GF27040@lark \
--to=wingo@pobox.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).