Marius Vollmer <[EMAIL PROTECTED]> 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