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

isThreadInterrupted

Last update:
May 18, 2026

Description

Checks whether a thread has been interrupted. The interrupted status of the thread is unaffected by this method. A thread interruption ignored because a thread was not alive at the time of the interrupt will be reflected by this method returning false.

Returns

True if a thread is interrupted.

Syntax

isThreadInterrupted(threadName)

Parameters

  • threadName: Name of the thread to interrupt.

History

  • ColdFusion (2025 release): Added the function.

Example

code
<cfscript>
        testThreadName = "thread-interrupted"
        thread action="run" name="#testThreadName#" {
            count = 0;
            while(!isThreadInterrupted(testThreadName)){
                variables.message = count++;
                writeOutput("thread #testThreadName# running.<br>");
            }
            writeOutput("Thread #testThreadName# interrupted. exiting.<br>");
        }
        sleep(2) //let the thread above startup.
        writeOutput("isInterrupted:" & isThreadInterrupted(testThreadName) & "<br>") //expect: no

        interruptThread(testThreadName);
        writeOutput("after interrupt, isInterrupted:" & isThreadInterrupted(testThreadName) & "<br>") //expect: yes
</cfscript>

Output

isInterrupted:NO

after interrupt, isInterrupted:YES

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