summaryrefslogtreecommitdiffstats
path: root/servers/visual/visual_server_wrap_mt.cpp
diff options
context:
space:
mode:
authorPedro J. Estébanez <pedrojrulez@gmail.com>2020-02-26 11:28:13 +0100
committerPedro J. Estébanez <pedrojrulez@gmail.com>2020-02-26 20:40:10 +0100
commit18fbdbb456c07a56b358bea2e392765fbcbb3283 (patch)
tree737363d20493afe45e75d932e0c1957dd9a79589 /servers/visual/visual_server_wrap_mt.cpp
parent1e57b558f215dd4920768e9567b6f55825877c89 (diff)
downloadredot-engine-18fbdbb456c07a56b358bea2e392765fbcbb3283.tar.gz
Reimplement Mutex with C++'s <mutex>
Main: - It's now implemented thanks to `<mutex>`. No more platform-specific implementations. - `BinaryMutex` (non-recursive) is added, as an alternative for special cases. - Doesn't need allocation/deallocation anymore. It can live in the stack and be part of other classes. - Because of that, it's methods are now `const` and the inner mutex is `mutable` so it can be easily used in `const` contexts. - A no-op implementation is provided if `NO_THREADS` is defined. No more need to add `#ifdef NO_THREADS` just for this. - `MutexLock` now takes a reference. At this point the cases of null `Mutex`es are rare. If you ever need that, just don't use `MutexLock`. - Thread-safe utilities are therefore simpler now. Misc.: - `ScopedMutexLock` is dropped and replaced by `MutexLock`, because they were pretty much the same. - Every case of lock, do-something, unlock is replaced by `MutexLock` (complex cases where it's not straightfoward are kept as as explicit lock and unlock). - `ShaderRD` contained an `std::mutex`, which has been replaced by `Mutex`.
Diffstat (limited to 'servers/visual/visual_server_wrap_mt.cpp')
-rw-r--r--servers/visual/visual_server_wrap_mt.cpp2
1 files changed, 0 insertions, 2 deletions
diff --git a/servers/visual/visual_server_wrap_mt.cpp b/servers/visual/visual_server_wrap_mt.cpp
index 9a5e5e896a..90d301c0cd 100644
--- a/servers/visual/visual_server_wrap_mt.cpp
+++ b/servers/visual/visual_server_wrap_mt.cpp
@@ -180,7 +180,6 @@ VisualServerWrapMT::VisualServerWrapMT(VisualServer *p_contained, bool p_create_
thread = NULL;
draw_pending = 0;
draw_thread_up = false;
- alloc_mutex = Mutex::create();
pool_max_size = GLOBAL_GET("memory/limits/multithreaded_server/rid_pool_prealloc");
if (!p_create_thread) {
@@ -193,6 +192,5 @@ VisualServerWrapMT::VisualServerWrapMT(VisualServer *p_contained, bool p_create_
VisualServerWrapMT::~VisualServerWrapMT() {
memdelete(visual_server);
- memdelete(alloc_mutex);
//finish();
}