lichao
2021-03-25 d3e7f93e69cb24c766292d8780e745caf24d42a8
src/shm_queue.h
@@ -53,7 +53,7 @@
    using Super::size;
    using Super::capacity;
    const MQId &Id() const { return id_; }
    bool Write(D buf, const int timeout_ms) {
    bool Write(const D &buf, const int timeout_ms) {
        Guard lock(mutex());
        if (cond_write_.timed_wait(lock, MSFromNow(timeout_ms), [&]() { return !this->full(); })) {
            this->push_back(buf);
@@ -67,7 +67,8 @@
    bool Read(D &buf, const int timeout_ms){
        Guard lock(mutex());
        if (cond_read_.timed_wait(lock, MSFromNow(timeout_ms), [&]() { return !this->empty(); })) {
            buf = this->front();
            using std::swap;
            swap(buf, this->front());
            this->pop_front();
            cond_write_.notify_one();
            return true;