librosie:rosie_new() is not thread-safe
In v1.0.0-beta-7, the functions in librosie appear to be thread-safe, except for the function that creates new engines, rosie_new()
.
With a sufficiently large number of threads (hundreds) creating new engines, there appears to be contention for the lib/*.luac
files that are loaded by the embedded Lua interpreter. If this is confirmed, then the best solution will be a change to the Lua source code to address the locking when loading code.
Until that time, a mutex should be added to rosie_new()
so that only one thread can run it at a time.
Thanks to Jean-Claude for finding the issue!