| 31 | } |
| 32 | |
| 33 | bool try_push(T &&item) { |
| 34 | { |
| 35 | std::unique_lock<std::mutex> lk(mutex); |
| 36 | if (content.size() == capacity) |
| 37 | return false; |
| 38 | content.push_back(std::move(item)); |
| 39 | } |
| 40 | not_empty.notify_one(); |
| 41 | return true; |
| 42 | } |
| 43 | |
| 44 | void pop(T &item) { |
| 45 | { |