[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: sleep
- From: RJP Computing <rjpcomputing@...>
- Date: Wed, 20 May 2009 22:58:10 -0400
On Wed, May 20, 2009 at 4:33 PM, Marco Antonio Abreu <firstname.lastname@example.org>
I am writting a script to copy some data from one database to another, this script will be running all the time, verifying if have something to copy.
I need to wait for some seconds between two checks, to do not overload the DB server or CPU.
How can I implement a function (or use if already has) to perform a "sleep", to wait some (milli)seconds doing nothing.
This is a Lua version and yes I know it is not a true Sleep because it uses CPU, but here you go:
function Delay( seconds )
local start = os.clock()
while os.clock() - start < seconds do end
Delay( .500 )
- sleep, Marco Antonio Abreu