mirror of https://github.com/PCSX2/pcsx2.git
gsdx sw: improve exit condition of SW extra thread
Use a relaxed atomic to read the exit variable in the hot path Wait that exit is deasserted in the destructor, so we are sure the thread will "soon" return
This commit is contained in:
parent
abc9f7d096
commit
d855bc5ca8
|
@ -113,7 +113,10 @@ protected:
|
|||
while (true) {
|
||||
|
||||
while (m_count == 0) {
|
||||
if (m_exit.load(memory_order_acquire)) return;
|
||||
if (m_exit.load(memory_order_relaxed)) {
|
||||
m_exit = false;
|
||||
return;
|
||||
}
|
||||
m_notempty.wait(l);
|
||||
}
|
||||
|
||||
|
@ -144,8 +147,10 @@ public:
|
|||
}
|
||||
|
||||
virtual ~GSJobQueue() {
|
||||
m_exit.store(true, memory_order_release);
|
||||
m_notempty.notify_one();
|
||||
m_exit = true;
|
||||
do {
|
||||
m_notempty.notify_one();
|
||||
} while (m_exit);
|
||||
this->CloseThread();
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue