Merge pull request #6162 from degasus/no_spin_loops
video_core: Avoid spin loops.
This commit is contained in:
commit
d6e5e053a6
6 changed files with 64 additions and 33 deletions
|
@ -83,11 +83,15 @@ public:
|
|||
return true;
|
||||
}
|
||||
|
||||
T PopWait() {
|
||||
void Wait() {
|
||||
if (Empty()) {
|
||||
std::unique_lock lock{cv_mutex};
|
||||
cv.wait(lock, [this]() { return !Empty(); });
|
||||
}
|
||||
}
|
||||
|
||||
T PopWait() {
|
||||
Wait();
|
||||
T t;
|
||||
Pop(t);
|
||||
return t;
|
||||
|
@ -156,6 +160,10 @@ public:
|
|||
return spsc_queue.Pop(t);
|
||||
}
|
||||
|
||||
void Wait() {
|
||||
spsc_queue.Wait();
|
||||
}
|
||||
|
||||
T PopWait() {
|
||||
return spsc_queue.PopWait();
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue