From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Kevin Ryde Newsgroups: gmane.lisp.guile.devel Subject: doco futures Date: Tue, 03 Jun 2003 10:05:21 +1000 Sender: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Message-ID: <87y90kdnzy.fsf@zip.com.au> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Trace: main.gmane.org 1054600205 30138 80.91.224.249 (3 Jun 2003 00:30:05 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Tue, 3 Jun 2003 00:30:05 +0000 (UTC) Original-X-From: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Tue Jun 03 02:30:01 2003 Return-path: Original-Received: from monty-python.gnu.org ([199.232.76.173]) by main.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 19Mzgf-0007lZ-00 for ; Tue, 03 Jun 2003 02:30:01 +0200 Original-Received: from localhost ([127.0.0.1] helo=monty-python.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.20) id 19Mzil-0000Tc-6P for guile-devel@m.gmane.org; Mon, 02 Jun 2003 20:32:11 -0400 Original-Received: from list by monty-python.gnu.org with tmda-scanned (Exim 4.20) id 19Mzfe-00083m-5i for guile-devel@gnu.org; Mon, 02 Jun 2003 20:28:58 -0400 Original-Received: from mail by monty-python.gnu.org with spam-scanned (Exim 4.20) id 19MzZy-0006Nt-0t for guile-devel@gnu.org; Mon, 02 Jun 2003 20:23:06 -0400 Original-Received: from snoopy.pacific.net.au ([61.8.0.36]) by monty-python.gnu.org with esmtp (Exim 4.20) id 19MzJ1-00034R-8C for guile-devel@gnu.org; Mon, 02 Jun 2003 20:05:35 -0400 Original-Received: from sunny.pacific.net.au (sunny.pacific.net.au [203.2.228.40]) h5305WPB001765 for ; Tue, 3 Jun 2003 10:05:32 +1000 Original-Received: from wisma.pacific.net.au (wisma.pacific.net.au [210.23.129.72]) by sunny.pacific.net.au with ESMTP id h5305WQg017270 for ; Tue, 3 Jun 2003 10:05:32 +1000 (EST) Original-Received: from localhost (ppp92.dyn228.pacific.net.au [203.143.228.92]) by wisma.pacific.net.au (8.12.9/8.12.9) with ESMTP id h5305UYZ020283 for ; Tue, 3 Jun 2003 10:05:30 +1000 (EST) Original-Received: from gg by localhost with local (Exim 3.35 #1 (Debian)) id 19MzIn-0002Qy-00; Tue, 03 Jun 2003 10:05:21 +1000 Original-To: guile-devel@gnu.org Mail-Copies-To: never User-Agent: Gnus/5.090019 (Oort Gnus v0.19) Emacs/21.2 (gnu/linux) X-BeenThere: guile-devel@gnu.org X-Mailman-Version: 2.1b5 Precedence: list List-Id: Developers list for Guile, the GNU extensibility library List-Help: List-Post: List-Subscribe: , List-Archive: List-Unsubscribe: , Errors-To: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Xref: main.gmane.org gmane.lisp.guile.devel:2483 X-Report-Spam: http://spam.gmane.org/gmane.lisp.guile.devel:2483 --=-=-= A small start at getting some stuff out of the NEWS file and into the manual. * scheme-scheduling.texi (Futures): New section. Dunno if make-future or the C functions should appear too. I'll leave that to an executive decision. Futures ======= Futures are a convenient way to run a calculation in a new thread, and only wait for the result when it's actually needed. Futures are similar to promises (*note Delayed Evaluation::), in that they allow mainline code to continue immediately. But `delay' doesn't evaluate at all until forced, whereas `future' starts immediately in a new thread. - syntax: future expr Begin evaluating EXPR in a new thread, and return a "future" object representing the calculation. - Scheme Procedure: future-ref f Return the value computed by the future F. If F has not yet finished executing then wait for it to do so. --=-=-= Content-Disposition: attachment; filename=scheme-scheduling.texi.futures.diff --- scheme-scheduling.texi.~1.10.~ 2003-05-05 10:18:26.000000000 +1000 +++ scheme-scheduling.texi 2003-06-01 08:55:41.000000000 +1000 @@ -12,6 +12,7 @@ * Dynamic Roots:: Root frames of execution. * Threads:: Multiple threads of execution. * Fluids:: Thread-local variables. +* Futures:: Delayed execution in new threads. @end menu @@ -647,6 +648,30 @@ when control enter or leaves the established dynamic extent. @end deffn + +@node Futures +@section Futures +@cindex futures + +Futures are a convenient way to run a calculation in a new thread, and +only wait for the result when it's actually needed. + +Futures are similar to promises (@pxref{Delayed Evaluation}), in that +they allow mainline code to continue immediately. But @code{delay} +doesn't evaluate at all until forced, whereas @code{future} starts +immediately in a new thread. + +@deffn {syntax} future expr +Begin evaluating @var{expr} in a new thread, and return a ``future'' +object representing the calculation. +@end deffn + +@deffn {Scheme Procedure} future-ref f +Return the value computed by the future @var{f}. If @var{f} has not +yet finished executing then wait for it to do so. +@end deffn + + @c Local Variables: @c TeX-master: "guile.texi" @c End: --=-=-= Content-Disposition: attachment; filename=NEWS.futures.diff --- NEWS.~1.393.~ 2003-05-22 11:39:29.000000000 +1000 +++ NEWS 2003-05-31 15:12:07.000000000 +1000 @@ -278,27 +278,10 @@ version string without the final micro-version number. See "Changes to the distribution" above. -** Futures +** Futures: future, future-ref -Futures is a way of providing an alternative evaluation policy, very -similar in principle to "promises". Like promises, futures allow the -main process to continue instantly, but while promises postpone -evaluation ("lazy" evaluation) until the value is requested, futures -immediately starts evaluation in a parallel thread. - -Futures are good when you want to express that "I'll need the value of -this computation sometime soon" and want to allow processing to go on -in the background until that time arrives. - -** New syntax: future FORM - -Begin evaluation of FORM in a parallel thread and return the future -immediately. (Akin to 'delay'.) - -** New procedure: future-ref FUTURE - -Return the computed value of the future. Wait if the computation is -not finished. (Akin to 'force'.) +Futures are like promises, but begun immediately in a new thread. See +"Futures" in the reference manual. ** New syntax: parallel FORM ... --=-=-= Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit _______________________________________________ Guile-devel mailing list Guile-devel@gnu.org http://mail.gnu.org/mailman/listinfo/guile-devel --=-=-=--