Returns true if the current thread has been interrupted, and clears the interrupted flag. Must be called from inside a ColdFusion thread; otherwise it throws an error.
threadInterrupted()
→ returns boolean
Checks the flag on each pass so the thread can stop cleanly. The pause gives the thread time to start; a thread interrupted before it starts ends with status TERMINATED.
thread name="worker" {
while (!threadInterrupted()) {
// do some work
}
}
sleep(200);
interruptThread("worker");
threadJoin("worker");
writeOutput(cfthread.worker.status);
Expected Result: COMPLETED
Signup for cfbreak to stay updated on the latest news from the ColdFusion / CFML community. One email, every friday.