From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Rob Browning Newsgroups: gmane.lisp.guile.devel Subject: Re: About 'futures' Date: Tue, 08 Mar 2005 15:37:36 -0600 Message-ID: <87sm35yg2n.fsf@trouble.defaultvalue.org> References: NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1110318917 28648 80.91.229.2 (8 Mar 2005 21:55:17 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Tue, 8 Mar 2005 21:55:17 +0000 (UTC) Cc: Mikael Djurfeldt , guile-devel@gnu.org Original-X-From: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Tue Mar 08 22:55:16 2005 Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1D8maw-0004Hi-R9 for guile-devel@m.gmane.org; Tue, 08 Mar 2005 22:50:29 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1D8mpU-00072A-LN for guile-devel@m.gmane.org; Tue, 08 Mar 2005 17:05:28 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1D8mf6-0003tl-T7 for guile-devel@gnu.org; Tue, 08 Mar 2005 16:54:46 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1D8mei-0003fl-Er for guile-devel@gnu.org; Tue, 08 Mar 2005 16:54:28 -0500 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1D8meh-0003eh-5d for guile-devel@gnu.org; Tue, 08 Mar 2005 16:54:19 -0500 Original-Received: from [66.93.216.237] (helo=defaultvalue.org) by monty-python.gnu.org with esmtp (Exim 4.34) id 1D8mOY-0006or-C6 for guile-devel@gnu.org; Tue, 08 Mar 2005 16:37:38 -0500 Original-Received: from trouble.defaultvalue.org (omen.defaultvalue.org [192.168.1.1]) by defaultvalue.org (Postfix) with ESMTP id 7E2394086; Tue, 8 Mar 2005 15:37:37 -0600 (CST) Original-Received: by trouble.defaultvalue.org (Postfix, from userid 1000) id 5076A3C103B; Tue, 8 Mar 2005 15:37:36 -0600 (CST) Original-To: Marius Vollmer In-Reply-To: (Marius Vollmer's message of "Tue, 08 Mar 2005 19:04:17 +0100") User-Agent: Gnus/5.1007 (Gnus v5.10.7) Emacs/21.3 (gnu/linux) X-BeenThere: guile-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Developers list for Guile, the GNU extensibility library" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Errors-To: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org X-MailScanner-To: guile-devel@m.gmane.org Xref: news.gmane.org gmane.lisp.guile.devel:4838 X-Report-Spam: http://spam.gmane.org/gmane.lisp.guile.devel:4838 Marius Vollmer writes: > what is the difference between > > (join-thread (begin-thread (foo))) > > and > > (future-ref (future (foo))) > > I am thinking about implementing futures as just > > (define-macro (future exp) `(begin-thread ,exp)) > (define future-ref join-thread) > > Would that make sense? Based on what I know of the semantics of the respective operations, it seems fine. Though is a terminated thread very "heavy"? i.e. is it much heavier than a cons pair? If so, then one optimization for futures would be to implement them such that when the thread is finished, the thread pointer is dropped, so that only the result remains. One way to do that might be to represent a future as (cons thread result-destination). Given that, future-ref would either join-thread or call cdr as appropriate. Although you'd probably also need a mutex which might obviate any potential resource savings achieved by dropping the thread. -- Rob Browning rlb @defaultvalue.org and @debian.org; previously @cs.utexas.edu GPG starting 2002-11-03 = 14DD 432F AE39 534D B592 F9A0 25C8 D377 8C7E 73A4 _______________________________________________ Guile-devel mailing list Guile-devel@gnu.org http://lists.gnu.org/mailman/listinfo/guile-devel