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-18 14:01:38 +01:00
parent 869f5b5328
commit 8ed259b792
20 changed files with 103 additions and 518 deletions

View File

@ -149,16 +149,15 @@ typedef Ref<Resource> RES;
class ResourceCache {
friend class Resource;
friend class ResourceLoader; //need the lock
static RWLock *lock;
static RWLock lock;
static HashMap<String, Resource *> resources;
#ifdef TOOLS_ENABLED
static HashMap<String, HashMap<String, int>> resource_path_cache; // each tscn has a set of resource paths and IDs
static RWLock *path_cache_lock;
static RWLock path_cache_lock;
#endif // TOOLS_ENABLED
friend void unregister_core_types();
static void clear();
friend void register_core_types();
static void setup();
public:
static void reload_externals();