mirror of
https://github.com/shadps4-emu/shadPS4.git
synced 2025-07-25 11:34:55 +00:00
avoiding deadlocks
This commit is contained in:
parent
8a4eb9ef7a
commit
8beb7a792a
@ -311,16 +311,21 @@ void VideoOutDriver::PresentThread(std::stop_token token) {
|
||||
}
|
||||
} else {
|
||||
Flip(request);
|
||||
{
|
||||
std::scoped_lock lock{request.port->port_mutex};
|
||||
request.port->flip_status.flip_pending_num--;
|
||||
if (request.eop) {
|
||||
request.port->flip_status.gc_queue_num--;
|
||||
// add second request to avoid potential deadlocks
|
||||
const auto second = receive_request();
|
||||
if (second) {
|
||||
Flip(second);
|
||||
{
|
||||
std::scoped_lock lock{second.port->port_mutex};
|
||||
second.port->flip_status.flip_pending_num--;
|
||||
if (second.eop) {
|
||||
second.port->flip_status.gc_queue_num--;
|
||||
}
|
||||
second.port->vo_cv
|
||||
.notify_all(); // wake up threads waiting to submit more flips
|
||||
}
|
||||
request.port->vo_cv
|
||||
.notify_one(); // this wake up threads waiting to submit more flips
|
||||
FRAME_END;
|
||||
}
|
||||
FRAME_END;
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user