CFLib.org – Common Function Library Project

Sleep(ms)

Last updated September 29, 2003

Version: 1 | Requires: ColdFusion MX | Library: UtilityLib

 
Rated 0 time(s). Average Rating: 0

Description:
This function causes the current java thread, ( the current CFMX page request) to go to sleep for a specified number of milliseconds. Not tested with CF5. Found in Pete Freitag's blog (cfm.blogspot.com).

Return Values:
Returns nothing.

Example:

view plain print about
<!---
There will be a 2 second delay...
<cfflush>
<cfset Sleep(2000)>
done waiting!
--->

Parameters:

Name Description Required
ms Number of miliseconds to sleep. Yes

Full UDF Source:

view plain print about
<cfscript>
/**
 * Causes the current request to wait for a specified amount of time.
 * 
 * @param ms      Number of miliseconds to sleep. (Required)
 * @return Returns nothing. 
 * @author Nathan Strutz (mrnate@hotmail.com) 
 * @version 1, September 29, 2003 
 */

function sleep(ms) {
    var thread = createObject("java""java.lang.Thread");
    thread.sleep(ms);
}
</cfscript>
blog comments powered by Disqus

Search CFLib.org


Latest Additions

Tayo Akinmade Tayo Akinmade added
arrayTrim
3 day(s) ago

Will Belden Will Belden added
longTime
9 day(s) ago

James Sleeman James Sleeman added
quickSort
19 day(s) ago

Ben Forta Ben Forta added
GetHostAddress
22 day(s) ago

Top Rated

Darwan Leonardo Sitepu EksporSQLData
Rated 5.0, 16 time(s)

Darwan Leonardo Sitepu backupDatabase
Rated 5.0, 13 time(s)

Barney Boisvert indentXml
Rated 5.0, 10 time(s)

Kevin Pepperman generateSsccAsn
Rated 5.0, 4 time(s)

Created by Raymond Camden / Design by Justin Johnson