unofficial mirror of guix-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: "Clément Lassieur" <clement@lassieur.org>
To: "Ludovic Courtès" <ludo@gnu.org>
Cc: Guix-devel <guix-devel@gnu.org>,
	Tatiana Sholokhova <tanja201396@gmail.com>
Subject: Re: packaging Bootstrap for Cuirass' web interface
Date: Fri, 27 Jul 2018 12:18:55 +0200	[thread overview]
Message-ID: <877elhj81c.fsf@lassieur.org> (raw)
In-Reply-To: <87k1phkqoo.fsf@gnu.org>

Ludovic Courtès <ludo@gnu.org> writes:

> Or maybe like this:
>
> (define (make-critical-section . args)
>   "Return a channel used to implement a critical section.  That channel can
> then be passed to 'join-critical-section', which will ensure sequential
> ordering.  ARGS are the arguments of the critical section.
>
> Critical sections are implemented by passing the procedure to execute to a
> dedicated fiber."
>   (let ((channel (make-channel)))
>     (spawn-fiber
>      (lambda ()
>        (let loop ()
>          (match (get-message channel)
>            (((? channel? reply) . (? procedure? proc))
>             (put-message reply (apply proc args))))
>          (loop))))
>     channel))
>
> (define (call-with-critical-section channel proc)
>   "Call PROC in the critical section corresponding to CHANNEL.  Return the
> result of PROC."
>   (let ((reply (make-channel)))
>     (put-message channel (cons reply proc))
>     (get-message reply)))
>
> That makes it clear that the reply channel is used only by the calling
> fiber.

I like it, but in that case MAKE-CHANNEL is called every time
CALL-WITH-CRITICAL-SECTION is called.  Do you think it is a significant
overhead?

Clément

  reply	other threads:[~2018-07-27 10:19 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-07-23  7:48 packaging Bootstrap for Cuirass' web interface Clément Lassieur
2018-07-23  8:03 ` Gábor Boskovits
2018-07-23  9:04   ` Ludovic Courtès
2018-07-23 11:29     ` Clément Lassieur
2018-07-24 20:29       ` Tatiana Sholokhova
2018-07-24 23:39         ` Clément Lassieur
2018-07-25  8:10           ` Clément Lassieur
2018-07-25  8:46             ` Clément Lassieur
2018-07-25  9:18               ` Clément Lassieur
2018-07-25 10:05               ` Gábor Boskovits
2018-07-25 10:16                 ` Clément Lassieur
2018-07-26  9:07                 ` Clément Lassieur
2018-07-26 13:41                   ` Ludovic Courtès
2018-07-27  1:43                     ` Clément Lassieur
2018-07-27  8:50                       ` Ludovic Courtès
2018-07-27 10:18                         ` Clément Lassieur [this message]
2018-07-27 17:43                           ` Clément Lassieur
2018-07-29 16:54                             ` Ludovic Courtès
2018-07-26 13:39               ` Ludovic Courtès
2018-07-29 23:45                 ` Clément Lassieur
2018-07-26 13:42           ` Ludovic Courtès
2018-07-23  9:31 ` Björn Höfling
2018-07-23 11:18   ` Clément Lassieur
2018-07-27  8:41   ` Chris Marusich

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=877elhj81c.fsf@lassieur.org \
    --to=clement@lassieur.org \
    --cc=guix-devel@gnu.org \
    --cc=ludo@gnu.org \
    --cc=tanja201396@gmail.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).