Whatever message this page gives is out now! Go check it out!

runAfterEitherAsync (Future method)

Last update:
May 18, 2026
When either this Future or another completes successfully first, runs an action with no arguments on the async executor.

Description

Use runAfterEitherAsync when you only need to know that one of two tasks finished, not which value won.

Returns

A new Future.

Category

Asynchronous programming

Function syntax

future.runAfterEitherAsync(other, action)

Parameters

ParameterDescription
otherRequired. The other Future to race.
actionRequired. A function with no parameters that performs an action (void return).

See also

Example

First completion runs the callback (from product tests).

 <cfscript>
    f1 = runAsync(function() { return 1; });
    f2 = runAsync(function() {    sleep(1000);    return 2;});
    after = f1.runAfterEitherAsync(f2, function() {    variables.ran = "YES";});
    after.get();
    writeOutput(variables.ran); // YES
</cfscript>
      

Share this page

Was this page helpful?
We're glad. Tell us how this page helped.
We're sorry. Can you tell us what didn't work for you?
Thank you for your feedback. Your response will help improve this page.

On this page