[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Lua and c interrupts (with lua callbacks)
- From: Kaos <kaos@...>
- Date: Thu, 27 Oct 2005 09:15:08 +0200
I'm experiencing some infrequent system hangs in my app, running mostly lua.
It's an embedded application, where all the hardware functionality is exposed
to lua, and all logic is running in lua with only glue parts running in c.
At some seemingly random points, the system however crashes, or hangs, since
there's no reset nor a call to the lua panic function. Almost always during
a gc cycle (or close to it) though.
I'm wondering if I'm abusing the lua environment with the way I'm forwarding
the c interrupts from the hardware to lua, if that may cause problems.
Here's how I've done it.
There's a process running in c, calling a (or rather several, any one who has
registered) lua function periodically to have the lua code running.
And when there's a interrupt, or a c callback gets called, it will also call
a lua function (in the same lua_State) although the c process might be in the middle
of one of it's periodic calls.
My real question becomes: is this safe? I'm a bit wary this might not be..
But before I go down and tear all this up (that works nice, most of the time)
to do it with one single point to enter lua from c, I would like to hear any
ideas/suggestions/thoughts from other lua practioneers!
Loads of Thanks in advance,