Add a mutex for library loading