Keep the bank lock until plugins are loaded.
This is a bit ugly but it fixes two race conditions: - loading plugins while another thread is initializing, - using the bank when the first thread has not completed loading plugins. Unfortunately, there is still a small race when module_need() calls AllocatePlugin(). It really should not -need to- do that, but the fix would be quite invasive. We would basically need to store plugin callbacks by names rather than function pointers. Then the module descriptors would be fully serializable, so we would not need to re-describe plugins when loading their shared object. That would also fix the last known corruption bug in the plugins cache.
Showing with 44 additions and 35 deletions