Modernize RWLock

- Based on C++14's `shared_time_mutex`
- No more need to allocate-deallocate or check for null
- No pointer anymore, just a member variable
- Platform-specific implementations no longer needed
- Simpler for `NO_THREADS`
This commit is contained in:
Pedro J. Estébanez
2021-01-25 19:48:38 +01:00
parent 96a3f01ac5
commit b450036120
23 changed files with 119 additions and 552 deletions

View File

@@ -929,9 +929,9 @@ void ClassDB::add_property_group(StringName p_class, const String &p_name, const
void ClassDB::add_property(StringName p_class, const PropertyInfo &p_pinfo, const StringName &p_setter, const StringName &p_getter, int p_index) {
lock->read_lock();
lock.read_lock();
ClassInfo *type = classes.getptr(p_class);
lock->read_unlock();
lock.read_unlock();
ERR_FAIL_COND(!type);
@@ -1447,12 +1447,7 @@ Variant ClassDB::class_get_default_property_value(const StringName &p_class, con
return default_values[p_class][p_property];
}
RWLock *ClassDB::lock = NULL;
void ClassDB::init() {
lock = RWLock::create();
}
RWLock ClassDB::lock;
void ClassDB::cleanup_defaults() {
@@ -1479,8 +1474,6 @@ void ClassDB::cleanup() {
classes.clear();
resource_base_extensions.clear();
compat_classes.clear();
memdelete(lock);
}
//