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

runAfterBoth

Last update:
May 18, 2026
When this Future and another Future both complete normally, runs a parameterless action on the completing thread.

Description

runAfterBoth is an instance method on a CFML Future. When this stage and other both complete successfully, your action runs on the completing thread. The action receives no arguments. Use it for cleanup or notifications that do not need the result values. A new Future is returned for chaining.
This is the synchronous counterpart to runAfterBothAsync.

Returns

A new Future.

Category

Asynchronous programming

Function syntax

future.runAfterBoth(other, action)

Parameters

ParameterDescription
otherRequired. The other Future to wait for.
actionRequired. A function with no parameters that performs work (void semantics).

Example

Run a flag after two tasks finish.

 <cfscript>
    f1 = runAsync(function() { return 1; });
    f2 = runAsync(function() { return 2; });
    after = f1.runAfterBoth(f2, function() {
        variables.executed = "DONE";
    });
    after.get();
    writeOutput(variables.executed); // DONE
</cfscript>
      

See also

thenAcceptBoth

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