-
Notifications
You must be signed in to change notification settings - Fork 26
Future Design and Implementation
Albert Netymk edited this page Feb 16, 2015
·
2 revisions
GC for non-primitive type inside future:
the producer of f
calls gc_send
, and inside get
we call gc_recv
.
One boolean flag is used so that gc_recv
is only called once so that #gc_recv == #gc_send
.
f' = chain f lambda
The chained closure would always run by the producer of the chained future. In the above example,
lambda
is run by the producer of f
.
Calling get on f'
would block the current actor until f'
becomes fulfillled due to the running of lambda
.
Limitation of current implementation:
- Calling
get
on self-fulfilling future causes deadlock. - Passing future to another actor is not supported. Call
get
, then pass the value instead. - Lambda used in future chaining is run by the producer, which would cause data race.