Merge pull request #83695 from YuriSizov/core-lock-and-key
Improve threading in ClassDB and EditorHelp
This commit is contained in:
@ -165,8 +165,8 @@ ClassDB::APIType ClassDB::get_api_type(const StringName &p_class) {
|
||||
}
|
||||
|
||||
uint32_t ClassDB::get_api_hash(APIType p_api) {
|
||||
OBJTYPE_RLOCK;
|
||||
#ifdef DEBUG_METHODS_ENABLED
|
||||
OBJTYPE_WLOCK;
|
||||
|
||||
if (api_hashes_cache.has(p_api)) {
|
||||
return api_hashes_cache[p_api];
|
||||
@ -175,7 +175,9 @@ uint32_t ClassDB::get_api_hash(APIType p_api) {
|
||||
uint64_t hash = hash_murmur3_one_64(HashMapHasherDefault::hash(VERSION_FULL_CONFIG));
|
||||
|
||||
List<StringName> class_list;
|
||||
ClassDB::get_class_list(&class_list);
|
||||
for (const KeyValue<StringName, ClassInfo> &E : classes) {
|
||||
class_list.push_back(E.key);
|
||||
}
|
||||
// Must be alphabetically sorted for hash to compute.
|
||||
class_list.sort_custom<StringName::AlphCompare>();
|
||||
|
||||
@ -859,8 +861,8 @@ void ClassDB::get_enum_constants(const StringName &p_class, const StringName &p_
|
||||
}
|
||||
|
||||
void ClassDB::set_method_error_return_values(const StringName &p_class, const StringName &p_method, const Vector<Error> &p_values) {
|
||||
OBJTYPE_RLOCK;
|
||||
#ifdef DEBUG_METHODS_ENABLED
|
||||
OBJTYPE_WLOCK;
|
||||
ClassInfo *type = classes.getptr(p_class);
|
||||
|
||||
ERR_FAIL_NULL(type);
|
||||
@ -871,6 +873,7 @@ void ClassDB::set_method_error_return_values(const StringName &p_class, const St
|
||||
|
||||
Vector<Error> ClassDB::get_method_error_return_values(const StringName &p_class, const StringName &p_method) {
|
||||
#ifdef DEBUG_METHODS_ENABLED
|
||||
OBJTYPE_RLOCK;
|
||||
ClassInfo *type = classes.getptr(p_class);
|
||||
|
||||
ERR_FAIL_NULL_V(type, Vector<Error>());
|
||||
@ -1415,6 +1418,8 @@ void ClassDB::_bind_compatibility(ClassInfo *type, MethodBind *p_method) {
|
||||
}
|
||||
|
||||
void ClassDB::_bind_method_custom(const StringName &p_class, MethodBind *p_method, bool p_compatibility) {
|
||||
OBJTYPE_WLOCK;
|
||||
|
||||
ClassInfo *type = classes.getptr(p_class);
|
||||
if (!type) {
|
||||
ERR_FAIL_MSG("Couldn't bind custom method '" + p_method->get_name() + "' for instance '" + p_class + "'.");
|
||||
|
||||
Reference in New Issue
Block a user