Skip to content

Instantly share code, notes, and snippets.

@christophervigliotti
Last active August 29, 2015 14:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save christophervigliotti/fb0fde8ad103463c9b5c to your computer and use it in GitHub Desktop.
Save christophervigliotti/fb0fde8ad103463c9b5c to your computer and use it in GitHub Desktop.
CFThread Is In The House
<cfset value = '' />
<cfthread name="aThread" action="run">
<cfset value = objectInstance.method(anArgument) />
</cfthread>
<cfset sleep(5000) /><!--- wait for a bit (give the thead a chance to complete) --->
<cfif ((aThread.Status IS "RUNNING") || (aThread.Status IS "NOT_STARTED"))><!--- if the thread is not done, kill it --->
<cfthread action="terminate" name="aThread" />
<cfset sleep(500) /><!--- sleep for a bit to properly terminate the thread --->
<cfset value = 'objectInstance.method did not respond in time' />
</cfif>
<cfoutput>
#value#
</cfoutput>
<!---
more here: http://help.adobe.com/livedocs/coldfusion/8/htmldocs/help.html?content=threads_3.html
--->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment