MCPcopy Create free account
hub / github.com/acl-dev/acl / push

Method push

lib_acl_cpp/include/acl_cpp/stdlib/tbox2.hpp:66–85  ·  view source on GitHub ↗

* Send message object * @param t {T} 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 */

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls 4

lockMethod · 0.45
push_backMethod · 0.45
notifyMethod · 0.45
unlockMethod · 0.45

Tested by

no test coverage detected