* Send message object * @param t {T*} Non-empty message object * @param notify_first {bool} If true, notify first then unlock, otherwise * unlock first * then notify. Note the difference between the two * @return {bool} * @override */
| 78 | * @override |
| 79 | */ |
| 80 | bool push(T* t, bool notify_first = true) { |
| 81 | if (! lock_.lock()) { abort(); } |
| 82 | tbox_.push_back(t); |
| 83 | size_++; |
| 84 | |
| 85 | if (notify_first) { |
| 86 | if (! cond_.notify()) { abort(); } |
| 87 | if (! lock_.unlock()) { abort(); } |
| 88 | } else { |
| 89 | if (! lock_.unlock()) { abort(); } |
| 90 | if (! cond_.notify()) { abort(); } |
| 91 | } |
| 92 | |
| 93 | return true; |
| 94 | } |
| 95 | |
| 96 | /** |
| 97 | * Receive message object |