From: "Julian Graham" <joolean@gmail.com>
To: "Ludovic Courtès" <ludo@gnu.org>
Cc: guile-devel@gnu.org
Subject: Re: thread cancellation, take 2
Date: Sun, 23 Sep 2007 14:39:17 -0400 [thread overview]
Message-ID: <2bc5f8210709231139x4ed56fc4q9ae28afdb707457b@mail.gmail.com> (raw)
In-Reply-To: <87vea1oe70.fsf@chbouib.org>
> Thinking a bit more about it, maybe we could let users handle the list
> of handlers if needed. That is, we'd have just
> `set-thread-cleanup-procedure!' (a two-argument procedure whose first
> arg is a thread) and `thread-cleanup-procedure' (a one-argument
> procedure); users who have cleanup code spread over several procedure
> would provide a procedure that iterates over such pieces of code. That
> would keep Guile's built-in mechanisms minimal.
>
> What do you think?
Well, in the use case for the native pthread_cancel implementation, it
makes a lot of sense to treat the handler list as a stack. That is,
you have something like:
[LOCK MUTEX 1]
pthread_cleanup_push([UNLOCK MUTEX 1])
[ ...CODE CONTAINING CANCELLATION POINTS... ]
[LOCK MUTEX 2]
pthread_cleanup_push([UNLOCK MUTEX 2])
[ ... ]
pthread_cleanup_pop()
[UNLOCK MUTEX 2]
[ ... ]
pthread_cleanup_pop()
[UNLOCK MUTEX 1]
What's useful about this is that you can have several resources at
different levels of nesting that need to be cleaned up at cancellation
time, but you only need to worry about pushing and popping handlers
within your own scope. If people feel that managing the entire list
at once is more Scheme-y, though, I can change it.
> First, you'll need to assign copyright to the FSF so that we can
> incorporate your changes (I'll send you the relevant stuff off-line).
> Then, you need to make sure your code follows the GNU Standards as much
> as possible (a few comments follow). Also, please add a few test cases
> to `threads.test' that exercise the new API.
Great -- I'll deal with the paperwork, add tests, and clean up the
code as you've suggested. I'll send the revisions to you offline, if
that's okay.
Thanks,
Julian
_______________________________________________
Guile-devel mailing list
Guile-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/guile-devel
next prev parent reply other threads:[~2007-09-23 18:39 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-09-20 14:30 thread cancellation, take 2 Julian Graham
2007-09-20 15:18 ` Ludovic Courtès
2007-09-20 15:36 ` Julian Graham
2007-09-23 5:16 ` Julian Graham
2007-09-23 10:42 ` Ludovic Courtès
2007-09-23 18:39 ` Julian Graham [this message]
2007-09-24 11:42 ` Ludovic Courtès
2007-09-24 15:39 ` Julian Graham
2007-09-24 20:17 ` Julian Graham
2007-09-26 4:03 ` Ludovic Courtès
2007-09-27 2:39 ` Julian Graham
2007-10-18 0:41 ` Julian Graham
2007-10-20 11:12 ` Ludovic Courtès
2007-10-20 13:02 ` Ludovic Courtès
2007-10-20 22:19 ` Julian Graham
2007-10-21 13:03 ` Ludovic Courtès
2007-10-21 13:11 ` Ludovic Courtès
2007-10-23 14:16 ` Julian Graham
2007-10-24 2:35 ` Julian Graham
2007-10-29 22:04 ` Ludovic Courtès
2007-10-29 22:20 ` Julian Graham
2007-10-29 23:23 ` Neil Jerram
2007-10-30 9:35 ` Ludovic Courtès
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=2bc5f8210709231139x4ed56fc4q9ae28afdb707457b@mail.gmail.com \
--to=joolean@gmail.com \
--cc=guile-devel@gnu.org \
--cc=ludo@gnu.org \
/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).