summaryrefslogtreecommitdiffstats
path: root/core/command_queue_mt.cpp
diff options
context:
space:
mode:
authorLyuma <xn.lyuma@gmail.com>2020-09-24 09:55:38 -0700
committerLyuma <xn.lyuma@gmail.com>2020-10-12 08:41:13 -0700
commit9f654b441fffa613568e30a4c53a57390be69e12 (patch)
tree71fee2e47ec1619ae5dde392581dac1602847560 /core/command_queue_mt.cpp
parent48e8da4aac6c2f6c56f38e2778329178b27666e7 (diff)
downloadredot-engine-9f654b441fffa613568e30a4c53a57390be69e12.tar.gz
core/command_queue_mt: Fix crash/hang when buffer fills up
This patch fixes two related issues. One is the race condition in issue #42107.. The other is a crash which happens when the reader is lapped near the end of the buffer.
Diffstat (limited to 'core/command_queue_mt.cpp')
-rw-r--r--core/command_queue_mt.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/core/command_queue_mt.cpp b/core/command_queue_mt.cpp
index 95fcd2c70e..a55eed5d3c 100644
--- a/core/command_queue_mt.cpp
+++ b/core/command_queue_mt.cpp
@@ -72,7 +72,7 @@ CommandQueueMT::SyncSemaphore *CommandQueueMT::_alloc_sync_sem() {
bool CommandQueueMT::dealloc_one() {
tryagain:
- if (dealloc_ptr == write_ptr) {
+ if (dealloc_ptr == (write_ptr_and_epoch >> 1)) {
// The queue is empty
return false;
}