diff options
author | Pedro J. Estébanez <pedrojrulez@gmail.com> | 2021-01-18 14:01:38 +0100 |
---|---|---|
committer | Pedro J. Estébanez <pedrojrulez@gmail.com> | 2021-01-19 11:53:10 +0100 |
commit | 8ed259b792f3a94939422384c829a6c6973afec8 (patch) | |
tree | 6ff66f499aeda5d36ba6d32eb4bafbcbe4e25b72 /scene | |
parent | 869f5b53288ec713553e024f91ec88b47ce960d9 (diff) |
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`
Diffstat (limited to 'scene')
-rw-r--r-- | scene/resources/texture.cpp | 9 | ||||
-rw-r--r-- | scene/resources/texture.h | 2 |
2 files changed, 1 insertions, 10 deletions
diff --git a/scene/resources/texture.cpp b/scene/resources/texture.cpp index 342a97fd85..9a987ae8b1 100644 --- a/scene/resources/texture.cpp +++ b/scene/resources/texture.cpp @@ -2136,20 +2136,11 @@ AnimatedTexture::AnimatedTexture() { pause = false; oneshot = false; RenderingServer::get_singleton()->connect("frame_pre_draw", callable_mp(this, &AnimatedTexture::_update_proxy)); - -#ifndef NO_THREADS - rw_lock = RWLock::create(); -#else - rw_lock = nullptr; -#endif } AnimatedTexture::~AnimatedTexture() { RS::get_singleton()->free(proxy); RS::get_singleton()->free(proxy_ph); - if (rw_lock) { - memdelete(rw_lock); - } } /////////////////////////////// diff --git a/scene/resources/texture.h b/scene/resources/texture.h index 3bbce050f7..83ef0c44ae 100644 --- a/scene/resources/texture.h +++ b/scene/resources/texture.h @@ -745,7 +745,7 @@ class AnimatedTexture : public Texture2D { GDCLASS(AnimatedTexture, Texture2D); //use readers writers lock for this, since its far more times read than written to - RWLock *rw_lock; + RWLock rw_lock; public: enum { |