|
@@ -83,11 +83,15 @@ public:
|
|
|
return true;
|
|
return true;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- T PopWait() {
|
|
|
|
|
|
|
+ void Wait() {
|
|
|
if (Empty()) {
|
|
if (Empty()) {
|
|
|
std::unique_lock lock{cv_mutex};
|
|
std::unique_lock lock{cv_mutex};
|
|
|
cv.wait(lock, [this]() { return !Empty(); });
|
|
cv.wait(lock, [this]() { return !Empty(); });
|
|
|
}
|
|
}
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ T PopWait() {
|
|
|
|
|
+ Wait();
|
|
|
T t;
|
|
T t;
|
|
|
Pop(t);
|
|
Pop(t);
|
|
|
return t;
|
|
return t;
|
|
@@ -156,6 +160,10 @@ public:
|
|
|
return spsc_queue.Pop(t);
|
|
return spsc_queue.Pop(t);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ void Wait() {
|
|
|
|
|
+ spsc_queue.Wait();
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
T PopWait() {
|
|
T PopWait() {
|
|
|
return spsc_queue.PopWait();
|
|
return spsc_queue.PopWait();
|
|
|
}
|
|
}
|