> Wouldn't you end up with 99% of critical path inside mutexes and thus gain nothing from threading it since each task will be blocking on the next? (and if the answer is 'no, because the tasks do more than the lua access - wouldn't a message queue to the main thread suffice?).
This reminds of a message I wanted to post in this thread but somehow never did.
I, too, think that Francisco's problem could be dealt with using a single Lua state that runs in a dedicated thread ("supervisor"), that reads and dispatches messages from a thread-safe queue, and all the other threads send messages to this queue when they need to interact with the supervisor, rather than using Lua API directly.
Cheers,
V.