mirror of
https://github.com/hrydgard/ppsspp.git
synced 2025-04-02 11:01:50 -04:00
ThreadManager: Check for exchange failure.
Even if expected stays null, since it's weak assume it can fail.
This commit is contained in:
parent
5907897c36
commit
7c7340e338
1 changed files with 2 additions and 2 deletions
|
@ -264,11 +264,11 @@ void ThreadManager::EnqueueTaskOnThread(int threadNum, Task *task) {
|
|||
|
||||
// Try first atomically, as highest priority.
|
||||
Task *expected = nullptr;
|
||||
thread->private_single.compare_exchange_weak(expected, task);
|
||||
bool queued = thread->private_single.compare_exchange_weak(expected, task);
|
||||
// Whether we got that or will have to wait, increase the queue counter.
|
||||
thread->queue_size++;
|
||||
|
||||
if (expected == nullptr) {
|
||||
if (queued) {
|
||||
std::unique_lock<std::mutex> lock(thread->mutex);
|
||||
thread->cond.notify_one();
|
||||
} else {
|
||||
|
|
Loading…
Add table
Reference in a new issue