unofficial mirror of guix-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Mathieu Othacehe <m.othacehe@gmail.com>
To: Andy Wingo <wingo@igalia.com>
Cc: guix-devel <guix-devel@gnu.org>, Amirouche <amirouche@hypermove.net>
Subject: Re: (guix git) and guile-git finalizers.
Date: Tue, 13 Jun 2017 18:39:12 +0200	[thread overview]
Message-ID: <87o9tr3kr3.fsf@gmail.com> (raw)
In-Reply-To: <cucpoe846lk.fsf@igalia.com>


Hi Andy,

> Nice sleuthing!

Thanks :)

>
> If you want to manually handle finalization at 'safe' points from
> Scheme, guardians are the things to use.  Add your "finalizable" object
> to a guardian, and periodically "pump" the guardian to see if anything
> is finalizable; you can run the finalizer there.

So, the idea would be to create a global guardian with :

--8<---------------cut here---------------start------------->8---
(define pointer-guardian (make-guardian))
--8<---------------cut here---------------end--------------->8---

and replace those kind of functions :

--8<---------------cut here---------------start------------->8---
(define (pointer->commit! pointer)
  (set-pointer-finalizer! pointer %commit-free)
  (pointer->commit pointer))
--8<---------------cut here---------------end--------------->8---

by,

--8<---------------cut here---------------start------------->8---
(define (pointer->commit! pointer)
  (pointer-guardian pointer)
  (pointer->commit pointer))
--8<---------------cut here---------------end--------------->8---

But then, at shutdown, when I'll call (pointer-guardian) to get the list
of free-able pointers, how can I know that %commit-free has to be called
on commit pointers, %reference-free on reference pointers, ... ?

Thanks,

Mathieu

      reply	other threads:[~2017-06-13 16:39 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-06-12 12:44 (guix git) and guile-git finalizers Mathieu Othacehe
2017-06-13  8:15 ` Ludovic Courtès
2017-06-13 16:41   ` Mathieu Othacehe
2017-06-19 16:01   ` Mathieu Othacehe
2017-06-22 11:40     ` Andy Wingo
2017-07-01 10:16       ` Mathieu Othacehe
2017-07-01 12:50         ` Ludovic Courtès
2017-07-01 14:33           ` Mathieu Othacehe
2017-06-13  8:47 ` Andy Wingo
2017-06-13 16:39   ` Mathieu Othacehe [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://guix.gnu.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87o9tr3kr3.fsf@gmail.com \
    --to=m.othacehe@gmail.com \
    --cc=amirouche@hypermove.net \
    --cc=guix-devel@gnu.org \
    --cc=wingo@igalia.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.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

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).