Out of curiousity, why does this affect the CPU any different than the JAVA 
thread?  The process still has to wait the same amount of time, doesn't it?  
Why call another external process?  Wouldn't that be more overhead?

I don't know much about Java, so my questions may sound stupid, but I think an 
explanation would be helpful to those on the list who also don't understand why 
this is bad.  It's not an endless loop and it's controlled by the input.  You 
could add a max amount in there if you wanted to avoid wait time's longer than 
a specified time.

Dave

-----Original Message-----
From: Nathan Strutz [mailto:[EMAIL PROTECTED]
Sent: Monday, August 22, 2005 1:34 PM
To: CF-Talk
Subject: Re: Is the a wait function in ColdFusion MX 6.1?


Ouch, don't do that.  This will spike your CPU, looping frantically 
until the given time comes up.

The java thread sleep method is much better.

Here's an already packaged function i pasted together a couple years ago.

www.cflib.org/udf.cfm/sleep

-nathan strutz


[EMAIL PROTECTED] wrote:
> Here's a way as a UDF:
> 
> <cfscript>
>       function WaitMS(ms) {
>               var startms = getTickCount();
>               var endms = startms + ms;
>               while (endms GT getTickCount());
> }     
> </cfscript>
> 
> Dave
> 
> On 22/08/05, Troy Simpson <[EMAIL PROTECTED]> wrote:
> 
>>I know this is not normally needed for a ColdFusion Application
>>because most people want their apps to run fast.
>>
>>But I have a need to put a wait period in my code.  If there a
>>function in ColdFusion MX 6.1 to cause the process to wait.  For
>>example:
>>
>>doSomething();
>>wait(500);  / wait 500 milliseconds.
>>doSomethingElse();
>>
>>Thanks,
>>Troy
>>
>>--
>>Troy Simpson
>>  Applications Analyst/Programmer, OCPDBA, MCSE, SCSA
>>North Carolina State University Libraries
>>Campus Box 7111 | Raleigh | North Carolina
>>ph.919.515.3855 | fax.919.513.3330
>>E-mail: [EMAIL PROTECTED]
> 
> ******************************************************************************************
> The information contained in this message, including attachments, may contain 
> privileged or confidential information that is intended to be delivered only 
> to the 
> person identified above. If you are not the intended recipient, or the person 
> responsible for delivering this message to the intended recipient, ALLTEL 
> requests 
> that you immediately notify the sender and asks that you do not read the 
> message or its 
> attachments, and that you delete them without copying or sending them to 
> anyone else. 
> 
> 
> 



~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Logware (www.logware.us): a new and convenient web-based time tracking 
application. Start tracking and documenting hours spent on a project or with a 
client with Logware today. Try it for free with a 15 day trial account.
http://www.houseoffusion.com/banners/view.cfm?bannerid=67

Message: http://www.houseoffusion.com/lists.cfm/link=i:4:215938
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54

Reply via email to