GetTickCount() returns system time in milliseconds so it would be easy enough to create something using the offset of a current GetTickCount with a previous GetTickCount.
Alternately, there is a sleep UDF at http://www.cflib.org/udf.cfm?ID=959 which uses the java Sleep function. Cheers. Scott. -----Original Message----- From: Roland Collins [mailto:[EMAIL PROTECTED] Sent: Wednesday, 14 January 2004 10:43 AM To: [EMAIL PROTECTED] Subject: [CFCDev] Threading question Hey guys, I'm writing a function that waits for a short time for a file to appear before timing out. The basic idea is function WaitForFile(somefile, timeout) starttime = now() bFileExists = FileExists(somefile) loop while not bFileExists and (now - startime) < timeout Sleep(1000) bFileExists = FileExists(somefile) end loop return bFileExists end function Since CF doesn't have a Sleep function, I'm stuck with workarounds. I can do it either by accessing the java.lang.Thread classes (much thanks to Christian's Blog at http://www.markme.com/cantrell/archives/002801.cfm), or by writing a COM object that does effectively the same thing. The question is: does blocking the currently executing CF thread using the java Sleep() method differ from blocking it using a synchronous COM method ? In other words, does anyone know of any internal CF quirks that would make it less safe to use the java method vs the COM method? Future-proofing is not a concern at this point, though I'd wager support for the java base classes isn't being removed from CF any time soon ;) <CFSCRIPT> thrd = CreateObject("java", "java.lang.Thread"); thrd.Sleep(javaCast("long", 10000)); </CFSCRIPT> TIA, RC Collins ---------------------------------------------------------- You are subscribed to cfcdev. To unsubscribe, send an email to [EMAIL PROTECTED] with the words 'unsubscribe cfcdev' in the message of the email. CFCDev is run by CFCZone (www.cfczone.org) and supported by Mindtool, Corporation (www.mindtool.com). An archive of the CFCDev list is available at www.mail-archive.com/[EMAIL PROTECTED] IMPORTANT NOTICE: This e-mail and any attachment to it are intended only to be read or used by the named addressee. It is confidential and may contain legally privileged information. No confidentiality or privilege is waived or lost by any mistaken transmission to you. The RTA is not responsible for any unauthorised alterations to this e-mail or attachment to it. Views expressed in this message are those of the individual sender, and are not necessarily the views of the RTA. If you receive this e-mail in error, please immediately delete it from your system and notify the sender. You must not disclose, copy or use any part of this e-mail if you are not the intended recipient. ---------------------------------------------------------- You are subscribed to cfcdev. To unsubscribe, send an email to [EMAIL PROTECTED] with the words 'unsubscribe cfcdev' in the message of the email. CFCDev is run by CFCZone (www.cfczone.org) and supported by Mindtool, Corporation (www.mindtool.com). An archive of the CFCDev list is available at www.mail-archive.com/[EMAIL PROTECTED]
