lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


Marco Antonio Abreu wrote:

> 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.

I didn't notice anyone mention this in the thread and although
I don't have a Lua specific info, I would like to point out
that, in general, sleeping is not the correct solution to the
problem.  It may be a more portable solution, and easiest
to implement, but it is much better to wait for an event.
Eg, have the OS send you a signal when there is some data
to be copied.  Is there a portable way to do this with
Lua?  I normally target Linux only and would simply
register for a SIGIO via fcntl.  I'm curious to know
if a portable solution exists.


-- 
William Pursell