Let languages init & finish run without locks held
This commit is contained in:
parent
59457685c1
commit
f05f8c399e
@ -223,26 +223,48 @@ void ScriptServer::init_languages() {
|
||||
}
|
||||
}
|
||||
|
||||
HashSet<ScriptLanguage *> langs_to_init;
|
||||
{
|
||||
MutexLock lock(languages_mutex);
|
||||
|
||||
for (int i = 0; i < _language_count; i++) {
|
||||
_languages[i]->init();
|
||||
if (_languages[i]) {
|
||||
langs_to_init.insert(_languages[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (ScriptLanguage *E : langs_to_init) {
|
||||
E->init();
|
||||
}
|
||||
|
||||
{
|
||||
MutexLock lock(languages_mutex);
|
||||
languages_ready = true;
|
||||
}
|
||||
}
|
||||
|
||||
void ScriptServer::finish_languages() {
|
||||
MutexLock lock(languages_mutex);
|
||||
HashSet<ScriptLanguage *> langs_to_finish;
|
||||
|
||||
for (int i = 0; i < _language_count; i++) {
|
||||
_languages[i]->finish();
|
||||
{
|
||||
MutexLock lock(languages_mutex);
|
||||
for (int i = 0; i < _language_count; i++) {
|
||||
if (_languages[i]) {
|
||||
langs_to_finish.insert(_languages[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
global_classes_clear();
|
||||
|
||||
languages_ready = false;
|
||||
for (ScriptLanguage *E : langs_to_finish) {
|
||||
E->finish();
|
||||
}
|
||||
|
||||
{
|
||||
MutexLock lock(languages_mutex);
|
||||
languages_ready = false;
|
||||
}
|
||||
|
||||
global_classes_clear();
|
||||
}
|
||||
|
||||
bool ScriptServer::are_languages_initialized() {
|
||||
|
Loading…
Reference in New Issue
Block a user