Let's say I have a wrapper program, that calls Lua, and most of my code
is Lua. Let's say my Lua code calls C plugins, (which were developed for
a different program) which may or may not be multithreaded.
The plugin does the following on a timer event: release a lock, and
acquire it again. When other threads want to call my code, they try to
acquire that lock, then call my code, then release it again.
What's the best way to support this? I obviously can't use the same lua
thread for it (I need a separate stack and stuff), but I'm not sure how
I _should_ do it.