User Guide Cancel

ThreadTerminate

 

Description

Terminates the thread specified by threadName. Behaves same as cfthread action="terminate".

Category

Exception handling functionsData output functions

Function syntax

ThreadTerminate(threadName)
ThreadTerminate(threadName)
ThreadTerminate(threadName)

See also

cfscriptcfthrowcftrycfcatch

History

ColdFusion 9: Added this function.

Parameters

Parameter

Description

threadName

The name of the thread to stop.

Usage

Use this function to stop processing of the thread specified in the threadName. If you terminate a thread, the thread scope includes an ERROR metadata structure that provides information about the termination.

Example

<cfscript>
thread name="t1"
{
sleep(3000);
}
sleep(1000);
threadTerminate("t1");
sleep(1000);
</cfscript>
<cfoutput>Status of the thread = #t1.Status#<br></cfoutput>
<cfscript> thread name="t1" { sleep(3000); } sleep(1000); threadTerminate("t1"); sleep(1000); </cfscript> <cfoutput>Status of the thread = #t1.Status#<br></cfoutput>
<cfscript> 
thread name="t1" 
{ 
sleep(3000); 
} 
sleep(1000); 
threadTerminate("t1"); 
sleep(1000); 
</cfscript> 
<cfoutput>Status of the thread = #t1.Status#<br></cfoutput>

Get help faster and easier

New user?