From mboxrd@z Thu Jan 1 00:00:00 1970 From: =?utf-8?Q?Cl=C3=A9ment?= Lassieur Subject: Re: packaging Bootstrap for Cuirass' web interface Date: Fri, 27 Jul 2018 12:18:55 +0200 Message-ID: <877elhj81c.fsf@lassieur.org> References: <87zhyitmtc.fsf@lassieur.org> <87pnzetjal.fsf@gnu.org> <87wotmtcks.fsf@lassieur.org> <5b578c0f.1c69fb81.4a8d1.0342@mx.google.com> <87bmawqk4m.fsf@lassieur.org> <87in53ka5r.fsf@lassieur.org> <87fu07k8iv.fsf@lassieur.org> <878t5yqsan.fsf@lassieur.org> <8736w6yv04.fsf@gnu.org> <877elhqwqf.fsf@lassieur.org> <87k1phkqoo.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:35663) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fizpx-0005gA-5J for guix-devel@gnu.org; Fri, 27 Jul 2018 06:19:06 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fizpw-0003Ag-75 for guix-devel@gnu.org; Fri, 27 Jul 2018 06:19:05 -0400 In-reply-to: <87k1phkqoo.fsf@gnu.org> List-Id: "Development of GNU Guix and the GNU System distribution." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-devel-bounces+gcggd-guix-devel=m.gmane.org@gnu.org Sender: "Guix-devel" To: Ludovic =?utf-8?Q?Court=C3=A8s?= Cc: Guix-devel , Tatiana Sholokhova Ludovic Court=C3=A8s writes: > Or maybe like this: > > (define (make-critical-section . args) > "Return a channel used to implement a critical section. That channel c= an > 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=C3=A9ment