Threading

From CEW

Jump to: navigation, search

Threading allows you to split up your scripts and run different logic in parallel. When used properly, it can help improve performance.

Both BlueDragon 7 and ColdFusion 8 support threading, however there are differences in their implementations. BlueDragon uses separate tags, whilst ColdFusion uses a single tag with an action attribute.


Contents

[edit] Creating

Spawns a new thread out of the current thread.

<cfthread action="run"/>
<cfthread>..</cfthread>

Supported by: Image:BlueDragon-7.0.png Image:ColdFusion-8.png

[edit] Joining

Waits for a thread to finish before joining it into the current thread and continuing.

<cfthread action="join"/>
<cfjoin/>

Supported by: Image:BlueDragon-7.0.png Image:ColdFusion-8.png

[edit] Sleeping

Sends a thread to sleep for a specified duration.

<cfthread action="sleep"/>
<cfpause/>

Supported by: Image:BlueDragon-7.0.png Image:ColdFusion-8.png

[edit] Interrupting

Interrupts a thread which is currently sleeping.

<cfinterrupt/>

Supported by: Image:BlueDragon-7.0.png

[edit] Stopping

Stops a thread which is running.

<cfthread action="terminate"/>

Supported by: Image:ColdFusion-8.png


[edit] functions

getAllThreads()

Returns an array of thread variables representing all actively running threads.

Supported by: Image:BlueDragon-7.0.png

ThreadInterrupt()

Interrupts a sleeping thread and allows it to continue running. Equivalent to cfinterrupt.

Supported by: Image:BlueDragon-7.0.png

ThreadIsAlive()

Returns true if the specified thread is still running.

Supported by: Image:BlueDragon-7.0.png

ThreadJoin()

Waits for a thread to finish before joining it into the current thread and continuing. Equivalent to cfjoin.

Supported by: Image:BlueDragon-7.0.png

ThreadRunningTime()

Returns the number of milliseconds the specified thread has been running for.

Supported by: Image:BlueDragon-7.0.png

ThreadStop()

Stops a thread which is running.

Supported by: Image:BlueDragon-7.0.png

Personal tools