Method: Kernel#await_fastest
- Defined in:
- lib/all/kernel.rb
#await_fastest(evaluation0, evaluation1, *more_evaluations, opts = {}) ⇒ Concurrently::Proc::Evaluation (private)
Waits for the first in a list of evaluations to be concluded.
238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 |
# File 'lib/all/kernel.rb', line 238 private def await_fastest(eval0, eval1, *evaluations) opts = (evaluations.last.is_a? Hash) ? evaluations.pop : {} evaluations.unshift eval0, eval1 if concluded = evaluations.find(&:concluded?) concluded else begin curr_eval = Concurrently::Evaluation.current evaluations.each{ |e| e.instance_eval{ @awaiting_result.store curr_eval, self } } await_resume! opts ensure evaluations.each{ |e| e.instance_eval{ @awaiting_result.delete curr_eval } } end end end |