|
@@ -22,7 +22,7 @@ public:
|
|
cond_var_.notify_one();
|
|
cond_var_.notify_one();
|
|
}
|
|
}
|
|
|
|
|
|
- bool tryPop(T& item) {
|
|
|
|
|
|
+ bool try_pop(T& item) {
|
|
std::lock_guard<std::mutex> lock(mutex_);
|
|
std::lock_guard<std::mutex> lock(mutex_);
|
|
if (queue_.empty()) {
|
|
if (queue_.empty()) {
|
|
return false;
|
|
return false;
|
|
@@ -32,7 +32,7 @@ public:
|
|
return true;
|
|
return true;
|
|
}
|
|
}
|
|
|
|
|
|
- T waitAndPop() {
|
|
|
|
|
|
+ T wait_pop() {
|
|
std::unique_lock<std::mutex> lock(mutex_);
|
|
std::unique_lock<std::mutex> lock(mutex_);
|
|
cond_var_.wait(lock, [this] { return !queue_.empty(); });
|
|
cond_var_.wait(lock, [this] { return !queue_.empty(); });
|
|
T item = std::move(queue_.front());
|
|
T item = std::move(queue_.front());
|