lua-users home
lua-l archive

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




On Wed, May 23, 2018 at 8:05 AM, Jeremy Jurksztowicz <jurksztowicz@gmail.com> wrote:
Hi, probably asked somewhere on the archive but my searches are turning up nil.

Wondering if I can get any understanding of what kind of Lua code I can write that will not invoke the memory allocator.
i.e. if I have a function that does not create any tables or strings, and I make sure that the lua_State has a lot of stack space, and pause the GC, and I only operate on numbers in a preallocated table, would it be reasonable to assume that the code would not block, and be suitable for signal processing?

I don't know about the memory allocator, but wouldn't you need a polling library to listen for signals and not block? I suspect you could mimic a polling library with a co-routine, but something like cqueues or luasys might be a requirement? I have no idea what environment you're working in so support for polling libraries might be a problem.

cqueues:
http://www.25thandclement.com/~william/projects/cqueues.pdf
https://github.com/wahern/cqueues

Luasys:
https://github.com/tnodir/luasys


I have been looking through the code and docs, but if anyone can point to some definitive material or share some caveats or encouragement, I’d really appreciate that.

Regards,
Jeremy J.