From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: ludo@gnu.org (Ludovic =?utf-8?Q?Court=C3=A8s?=) Newsgroups: gmane.lisp.guile.devel Subject: Re: [PATCH] Futures: Avoid creating the worker pool more than once Date: Sat, 17 Nov 2012 00:15:07 +0100 Message-ID: <87pq3dw35w.fsf@gnu.org> References: <87a9uu9vpk.fsf@tines.lan> <87r4o58r0f.fsf@tines.lan> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Trace: ger.gmane.org 1353107730 3394 80.91.229.3 (16 Nov 2012 23:15:30 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 16 Nov 2012 23:15:30 +0000 (UTC) To: guile-devel@gnu.org Original-X-From: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Sat Nov 17 00:15:41 2012 Return-path: Envelope-to: guile-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1TZV8O-0006AD-O0 for guile-devel@m.gmane.org; Sat, 17 Nov 2012 00:15:40 +0100 Original-Received: from localhost ([::1]:60210 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TZV8E-0003YB-KY for guile-devel@m.gmane.org; Fri, 16 Nov 2012 18:15:30 -0500 Original-Received: from eggs.gnu.org ([208.118.235.92]:42669) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TZV89-0003Ve-Ln for guile-devel@gnu.org; Fri, 16 Nov 2012 18:15:28 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TZV86-0004V9-Jf for guile-devel@gnu.org; Fri, 16 Nov 2012 18:15:25 -0500 Original-Received: from plane.gmane.org ([80.91.229.3]:52206) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TZV86-0004Uq-Cm for guile-devel@gnu.org; Fri, 16 Nov 2012 18:15:22 -0500 Original-Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1TZV8C-0005zM-Bk for guile-devel@gnu.org; Sat, 17 Nov 2012 00:15:28 +0100 Original-Received: from reverse-83.fdn.fr ([80.67.176.83]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Sat, 17 Nov 2012 00:15:28 +0100 Original-Received: from ludo by reverse-83.fdn.fr with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Sat, 17 Nov 2012 00:15:28 +0100 X-Injected-Via-Gmane: http://gmane.org/ Original-Lines: 36 Original-X-Complaints-To: usenet@ger.gmane.org X-Gmane-NNTP-Posting-Host: reverse-83.fdn.fr X-URL: http://www.fdn.fr/~lcourtes/ X-Revolutionary-Date: 27 Brumaire an 221 de la =?utf-8?Q?R=C3=A9volution?= X-PGP-Key-ID: 0xEA52ECF4 X-PGP-Key: http://www.fdn.fr/~lcourtes/ludovic.asc X-PGP-Fingerprint: 83C4 F8E5 10A3 3B4C 5BEA D15D 77DD 95E2 EA52 ECF4 X-OS: x86_64-unknown-linux-gnu User-Agent: Gnus/5.130005 (Ma Gnus v0.5) Emacs/24.2 (gnu/linux) Cancel-Lock: sha1:Ka7R78ybbIyB1S+Dk/ZAWLn1T8o= X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 80.91.229.3 X-BeenThere: guile-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Developers list for Guile, the GNU extensibility library" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Original-Sender: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.lisp.guile.devel:15188 Archived-At: Hi Mark, Mark H Weaver skribis: > From b0d936a348b916e73e9071abeb7baae3d7c126d3 Mon Sep 17 00:00:00 2001 > From: Mark H Weaver > Date: Wed, 7 Nov 2012 08:39:42 -0500 > Subject: [PATCH] Futures: Avoid creating the worker pool more than once. > > * module/ice-9/futures.scm (%create-workers!): Use 'with-mutex' in case > an exception is thrown. Within the critical section, check to make > sure the worker pool hasn't already been created by another thread. > --- > module/ice-9/futures.scm | 24 +++++++++++++++--------- > 1 file changed, 15 insertions(+), 9 deletions(-) > > > diff --git a/module/ice-9/futures.scm b/module/ice-9/futures.scm > index 0f64b5c..7fbccf6 100644 > --- a/module/ice-9/futures.scm > +++ b/module/ice-9/futures.scm > @@ -19,6 +19,7 @@ > (define-module (ice-9 futures) > #:use-module (srfi srfi-1) > #:use-module (srfi srfi-9) > + #:use-module (ice-9 threads) > #:use-module (ice-9 q) > #:export (future make-future future? touch)) I just realized that this patch introduces a circular dependency between the two modules. Can you think of a way to avoid it? Thanks, Ludo’.