* ������Ϣ���� * @param t {T} ��Ϣ���� * @param notify_first {bool} ���Ϊ true������֪ͨ������������Ƚ��� * ��֪ͨ��ע����ߵ����� * @return {bool} * @override */
| 62 | * @override |
| 63 | */ |
| 64 | bool push(T t, bool notify_first = true) { |
| 65 | if (! lock_.lock()) { abort(); } |
| 66 | |
| 67 | #if __cplusplus >= 201103L || defined(USE_CPP11) // Support c++11 ? |
| 68 | box_.emplace_back(t); |
| 69 | #else |
| 70 | box_.push_back(t); |
| 71 | #endif |
| 72 | size_++; |
| 73 | |
| 74 | if (notify_first) { |
| 75 | if (!cond_.notify()) { abort(); } |
| 76 | if (!lock_.unlock()) { abort(); } |
| 77 | } else { |
| 78 | if (!lock_.unlock()) { abort(); } |
| 79 | if (!cond_.notify()) { abort(); } |
| 80 | } |
| 81 | |
| 82 | return true; |
| 83 | } |
| 84 | |
| 85 | /** |
| 86 | * ������Ϣ���� |