File tree Expand file tree Collapse file tree 1 file changed +6
-0
lines changed Expand file tree Collapse file tree 1 file changed +6
-0
lines changed Original file line number Diff line number Diff line change @@ -128,18 +128,24 @@ class SynchronizedObject < RubySynchronizedObject
128
128
class Future < SynchronizedObject
129
129
module Shortcuts
130
130
131
+ # Constructs new Future which will be completed after block is evaluated on executor. Evaluation begins immediately.
131
132
# @return [Future]
132
133
def future ( executor = :fast , &block )
133
134
ConcurrentNext ::Immediate . new ( executor , &block ) . future
134
135
end
135
136
136
137
alias_method :async , :future
137
138
139
+ # Constructs new Future which will be completed after block is evaluated on executor. Evaluation is delays until
140
+ # requested by {Future#wait} method, {Future#value} and {Future#value!} methods are calling {Future#wait} internally.
138
141
# @return [Delay]
139
142
def delay ( executor = :fast , &block )
140
143
ConcurrentNext ::Delay . new ( nil , executor , &block ) . future
141
144
end
142
145
146
+ # Constructs {Promise} which helds its {Future} in {Promise#future} method. Intended for completion by user.
147
+ # User is responsible not to complete the Promise twice.
148
+ # @return [Promise] in this case instance of {OuterPromise}
143
149
def promise ( executor = :fast )
144
150
ConcurrentNext ::OuterPromise . new ( [ ] , executor )
145
151
end
You can’t perform that action at this time.
0 commit comments