You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-07 12:30:27 +00:00
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.
Backport of 48e8da4 to 3.2
This commit is contained in:
@@ -80,7 +80,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;
|
||||
}
|
||||
@@ -104,8 +104,8 @@ tryagain:
|
||||
|
||||
CommandQueueMT::CommandQueueMT(bool p_sync) {
|
||||
|
||||
read_ptr = 0;
|
||||
write_ptr = 0;
|
||||
read_ptr_and_epoch = 0;
|
||||
write_ptr_and_epoch = 0;
|
||||
dealloc_ptr = 0;
|
||||
mutex = Mutex::create();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user