mirror of
https://github.com/godotengine/godot.git
synced 2024-11-22 12:12:28 +00:00
Merge pull request #84847 from RandomShaper/lang_init_term
Let languages init & finish run without locks held
This commit is contained in:
commit
a28476d1cd
@ -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