]> gitweb.factorcode.org Git - factor.git/blob - basis/concurrency/futures/futures.factor
core, basis, extra: Remove DOS line endings from files.
[factor.git] / basis / concurrency / futures / futures.factor
1 ! Copyright (C) 2005, 2008 Chris Double, Slava Pestov.
2 ! See http://factorcode.org/license.txt for BSD license.
3 USING: concurrency.promises concurrency.mailboxes kernel arrays
4 continuations accessors fry ;
5 IN: concurrency.futures
6
7 : future ( quot -- future )
8     <promise> [
9         [ '[ @ _ fulfill ] "Future" ] keep
10         mailbox>> spawn-linked-to drop
11     ] keep ; inline
12
13 : ?future-timeout ( future timeout -- value )
14     ?promise-timeout ?linked ;
15
16 : ?future ( future -- value )
17     ?promise ?linked ;