amInCFThread()
Last updated April 11, 2008
Version: 1 | Requires: ColdFusion 8 | 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:
//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
Tayo Akinmade added
arrayTrim
11 day(s) ago
Will Belden added
longTime
17 day(s) ago
James Sleeman added
quickSort
27 day(s) ago
Ben Forta added
GetHostAddress
29 day(s) ago
Top Rated
EksporSQLData
Rated 5.0, 16 time(s)
backupDatabase
Rated 5.0, 13 time(s)
indentXml
Rated 5.0, 10 time(s)
generateSsccAsn
Rated 5.0, 4 time(s)