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

ThreadJoin

Last update:
Jun 9, 2026

Description

Makes the current thread wait until the thread or threads specified complete processing.

Category

Function syntax

ThreadJoin([threadName], [timeout])

See also

History

ColdFusion 9: Added this function.

Parameters

ParameterDescription
threadName
The name of the thread or threads to join to the current thread. To specify multiple threads, use a comma-separated list.
timeout
The number of milliseconds for which to suspend thread processing.

Usage

Makes the current thread wait until the thread or threads specified in the {{threadName}}parameter complete processing, or until the period specified in the {{timeout}}parameter passes, before continuing processing.
  • ThreadJoin(): Current thread waits for all ColdFusion threads to complete processing.
  • ThreadJoin(threadName): Makes current thread wait for the specified thread to finish execution.
  • ThreadJoin(threadNametimeout): Makes the current thread wait until execution timeout for one or many threads specified by threadName. If you do not specify a timeout and the thread you are joining to does not finish, the current thread also cannot finish processing.

Example

<cfscript> 
thread name="t1" 

sleep(5000); 

thread name="t2" 

threadjoin("t1",1000); 

threadjoin("t2"); 
</cfscript> 
<cfoutput>Status of the thread T1 = #t1.Status#<br></cfoutput> 
<cfoutput>Status of the thread T2 = #t2.Status#<br></cfoutput>

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