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.