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

thenAcceptBoth

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

Description

thenAcceptBoth 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 both results and performs a side effect (void semantics). A new Future is returned for chaining.
This is the synchronous counterpart to thenAcceptBothAsync.

Returns

A new Future.

Category

Asynchronous programming

Function syntax

future.thenAcceptBoth(other, action)

Parameters

ParameterDescription
otherRequired. The other Future to wait for.
actionRequired. A function that accepts both results and performs work (void semantics).

Example

Concatenate two async strings after both complete.

<cfscript>
    f1 = runAsync(function() { return "A"; });
    f2 = runAsync(function() { return "B"; });
    consumed = f1.thenAcceptBoth(f2, function(x, y) {
        variables.result = x & y;
    });
    consumed.get();
    writeOutput(variables.result); // AB
</cfscript>
      

See also

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