lua-users home
lua-l archive

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

>From: Steve Dekorte <>
> (Luiz Henrique de Figueiredo) wrote:
>> >> Jim  Mathies <> wrote:
>> >> > Do you know of any way to interrupt the running VM by making a call
>> >> > into it while a separate thread is executing a program?
>> You may try to set the call hook and then call error inside it.
>> I think this will interrupt the current chunk.
>That's very slow, isn't it?

Well, depends on what you call "slow".
As a programmer, I understand this "concern". But we're talking here about an
interpreted language (even if it's one of the fastest around). My point is that,
in any interpreted language, the VM simulation is by far the slowest part of
the code, to the point that the mere loop overhead is comparable to most
opcodes. So, how slow is slow?

Someone else suggested adding a flag to the global state. It's a good solution.
but requires changing the official code.
Now, this too will be "slow": merely checking this flag will be comparable to
many opcodes.

Bottom line: try it and see if it's slow in your applications.