factor/extra/concurrency/futures/futures.factor

18 lines
531 B
Factor
Raw Normal View History

2008-02-18 06:07:40 -05:00
! Copyright (C) 2005, 2008 Chris Double, Slava Pestov.
! See http://factorcode.org/license.txt for BSD license.
USING: concurrency.promises concurrency.mailboxes kernel arrays
2008-02-18 10:08:59 -05:00
continuations ;
2008-02-18 06:07:40 -05:00
IN: concurrency.futures
: future ( quot -- future )
<promise> [
2008-02-18 10:08:59 -05:00
[ [ >r call r> fulfill ] 2curry "Future" ] keep
promise-mailbox spawn-linked-to drop
2008-02-18 06:07:40 -05:00
] keep ; inline
: ?future-timeout ( future timeout -- value )
?promise-timeout ?linked ;
2008-02-18 06:07:40 -05:00
: ?future ( future -- value )
?promise ?linked ;