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

thenCombine

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

Description

thenCombine is an instance method on a CFML Future. You pass a second Future (other) and a combining function. When both stages complete successfully, the combiner runs on the completing thread and returns one new value. The method returns a new Future that completes with that combined value.
This is the synchronous counterpart to thenCombineAsync.

Returns

A new Future.

Category

Asynchronous programming

Function syntax

future.thenCombine(other, function)

Parameters

ParameterDescription
otherRequired. The other Future to wait for.
functionRequired. A function that accepts both results (this stage first, then other) and returns the combined value.

Example

Add two async results after both complete.

<cfscript>
    f1 = runAsync(function() { return 10; });
    f2 = runAsync(function() { return 20; });
    combined = f1.thenCombine(f2, function(x, y) { return x + y; });
    writeOutput(combined.get()); // 30
</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