amInCFThread()
Last updated April 11, 2008
Version: 1 | Requires: CF8 | Library: UtilityLib
Description:
Allows for the checking of executing code is being run inside a cfthread block or not.
Return Values:
Returns a boolean.
Example:
<cfscript>
//get the response writer, so we can write to the HTTP Stream
//from within a cfthread call
out = getPageContext().getResponse().getWriter();
out.write("on cfthread: " & amInCFThread());
</cfscript>
<hr>
<cfthread action="run" name="test">
<cfscript>
out.write("on cfthread: " & amInCFThread());
</cfscript>
</cfthread>
Parameters:
No arguments.
Full UDF Source:
<!---
returns 'true' if the currentthread is a cfthread, rerturns false otherwise
@return Returns a boolean.
@author Mark Mandel (mark@compoundtheory.com)
@version 1, April 11, 2008
--->
<cffunction name="amInCFThread" hint="returns 'true' if the current thread if a cfthread, rerturns false otherwise" access="public" returntype="boolean" output="false">
<cfscript>
var Thread = createObject("java", "java.lang.Thread");
if(Thread.currentThread().getThreadGroup().getName() eq "cfthread")
{
return true;
}
return false;
</cfscript>
</cffunction>
Search CFLib.org
Latest Additions
Raymond Camden added
QueryDeleteRows
November 04, 2017
Leigh added
nullPad
May 11, 2016
Raymond Camden added
stripHTML
May 10, 2016
Kevin Cotton added
date2ExcelDate
May 05, 2016
Raymond Camden added
CapFirst
April 25, 2016