Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Stopping a runaway Lua subprocess

I have embedded Lua in an Objective-C application using LuaObjCBridge. I need to know how to stop the Lua process if it taking too much time (infinite loop?).

Would running it in a separate thread help?

like image 317
John Smith Avatar asked Jan 19 '26 01:01

John Smith


1 Answers

The usual way to do this is to use lua_sethook to schedule a callback every count VM instructions; when the callback lua_Hook function occurs after a excessive time your hook function can raise an error forcing control to your protected call.

like image 166
Doug Currie Avatar answered Jan 21 '26 15:01

Doug Currie



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!