Yakov Lerner wrote:
On 5/1/07, Yakov Lerner <[EMAIL PROTECTED]> wrote:
[...]
How about using SIGALRM when search is progressing, every second ?
SIGALRM handler would store time() into global var (and reload alarm(1)).
The search would check the global var for changes, every line.
It is cheap to check global integer (time_t) var, no ?

What do you think about SIGALRM, Bram ?

Yakov


I don't know about Bram, but how portable is SIGALRM? Can you use it on non-Unix-like systems such as Windows?

Wouldn't counting lines be both simpler and more portable? You could either display ...nnn lines scanned... every (e.g.) 100 lines or so, or else determine during startup how long it takes to get the time (maybe as an average of 5 tries if you want less stochastic variability) then check the time it every n lines, with n being a monotonous non-decreasing function of the time delay thus obtained.

Lines of wildly varying length would make the display change at variable time intervals (in the second case, if the lines are long enough to require more than, say, one second between successive checks of the clock), but that shouldn't be a very serious problem.


Best regards,
Tony.
--
Your lucky number has been disconnected.

Reply via email to