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]

Reply via email to