chapter31

development in a land far far away…

at the moment

History is not what happened. History is what was written down.

Often times you want the server to pause execution of a page, or go to sleep for a short while. You may be waiting for a file to be written to the file system etc.

You can do achieve this in the following fashion:

The example above makes the server call “sleep” for 5 seconds.

Ryan Duckworth states:

“A java thread (which ColdFusion code is converted to) is doing a NOP (no operation) procedure during a java Sleep command which causes no inefficiency. The multi-processing nature of the CPU handles this functionality for you and will use those CPU cycles with other requests during the sleep.”

Note that I usually have this in a Utility component with lots of functions I can call when needed. For example:

So then I can call application.utility.sleep(1000);

:)


Related Pages

2 Responses to “Making ColdFusion sleep”

  1. in CF8 there is now a Slep function which is identical to this.

    Simeon

  2. Yep, CF8 is such a great release with a bunch of goodies!

    Michael Sharman

Leave a Reply