lua-users home
lua-l archive

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


On 2013-08-26 08:37:01 +0000, Thijs Schreijer said:



-----Original Message-----
From: lua-l-bounces@lists.lua.org [mailto:lua-l-bounces@lists.lua.org] On
Behalf Of Philipp Kraus
Sent: maandag 26 augustus 2013 7:39
To: list Lua mailing
Subject: infinity loop / recursion

Hello,

I'm using LUA for a simulation on a cluster system, so my user can define
their own scripts. In some cases there exists a infinite loop or infinity
recursion in the LUA code so the simulation does not stop anymore.
My idea is to create a maximum execution time (like PHP) with a watchdog
(I don't use a formal verification of the code e.g. wp-calculus). Each
script has got a defined function which is called by my C++
class, so I would like to send the LUA script a "warning" that the max.
execution time is reached, but if the script does not stop, the C++ side
should stop the script.

Can I / How can I stop a running script from C side?
Do you think it is a good idea to send a warning first, because the script
does not use threads, so IMHO the warning can not be handled by the
script?
I hope for some ideas

Thanks

Phil


Have a look at this code [1] for some ideas, though this is Lua only.

Thijs


As a side note: Lua is not an acronym, it's a name, so not allcaps. Makes me wonder where the watchdogs are? Usually others on this list beat me to this :)

[1] https://github.com/Tieske/corowatch

Great link thanks

Phil