[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: packaging Bootstrap for Cuirass' web interface
From: |
Clément Lassieur |
Subject: |
Re: packaging Bootstrap for Cuirass' web interface |
Date: |
Fri, 27 Jul 2018 12:18:55 +0200 |
User-agent: |
mu4e 1.0; emacs 26.1 |
Ludovic Courtès <address@hidden> 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
- Re: packaging Bootstrap for Cuirass' web interface, (continued)
- Re: packaging Bootstrap for Cuirass' web interface, Clément Lassieur, 2018/07/24
- Re: packaging Bootstrap for Cuirass' web interface, Clément Lassieur, 2018/07/25
- Re: packaging Bootstrap for Cuirass' web interface, Clément Lassieur, 2018/07/25
- Re: packaging Bootstrap for Cuirass' web interface, Clément Lassieur, 2018/07/25
- Re: packaging Bootstrap for Cuirass' web interface, Gábor Boskovits, 2018/07/25
- Re: packaging Bootstrap for Cuirass' web interface, Clément Lassieur, 2018/07/25
- Re: packaging Bootstrap for Cuirass' web interface, Clément Lassieur, 2018/07/26
- Re: packaging Bootstrap for Cuirass' web interface, Ludovic Courtès, 2018/07/26
- Re: packaging Bootstrap for Cuirass' web interface, Clément Lassieur, 2018/07/26
- Re: packaging Bootstrap for Cuirass' web interface, Ludovic Courtès, 2018/07/27
- Re: packaging Bootstrap for Cuirass' web interface,
Clément Lassieur <=
- Re: packaging Bootstrap for Cuirass' web interface, Clément Lassieur, 2018/07/27
- Re: packaging Bootstrap for Cuirass' web interface, Ludovic Courtès, 2018/07/29
- Re: packaging Bootstrap for Cuirass' web interface, Ludovic Courtès, 2018/07/26
- Re: packaging Bootstrap for Cuirass' web interface, Clément Lassieur, 2018/07/29
- Re: packaging Bootstrap for Cuirass' web interface, Ludovic Courtès, 2018/07/26
Re: packaging Bootstrap for Cuirass' web interface, Björn Höfling, 2018/07/23