[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: hook question
- From: Mike Pall <mikelu-0610@...>
- Date: Mon, 9 Oct 2006 18:55:36 +0200
Hi,
David Burgess wrote:
> Yes, but given that the hook function gets called a lot. I was
> hoping to avoid the registry lookups and just access my counters
> on the C side (seaside?).
Two solutions:
- Just call your hook function less often. Set the hook count to
a high number (10000 or so). Your timeout is fatal, so it
doesn't have to be precise, right? Ensure that none of the C
functions delay execution unduly.
- Setup a POSIX timer or a Windows thread which waits on the
timeout. Then in the timeout handler set the lua hook with a
count of 1. This is safe, even from a signal handler or a
different thread. It's also the fastest solution because the
hook is not active during regular execution.
Another hint: do not use the line hook, except for debugging.
It slows down execution a lot more than the count hook.
Bye,
Mike