71 {
72 if (info == nullptr) {
74 return false;
75 }
76
77 if (is_shutdown_.load()) {
78 ADEBUG <<
"notifier is shutdown.";
79 return false;
80 }
81
82 int timeout_us = timeout_ms * 1000;
83 while (!is_shutdown_.load()) {
84 uint64_t
seq = indicator_->next_seq.load();
85 if (seq != next_seq_) {
87 auto actual_seq = indicator_->seqs[idx];
88 if (actual_seq >= next_seq_) {
89 next_seq_ = actual_seq;
90 *info = indicator_->infos[idx];
91 ++next_seq_;
92 return true;
93 } else {
94 ADEBUG <<
"seq[" << next_seq_ <<
"] is writing, can not read now.";
95 }
96 }
97
98 if (timeout_us > 0) {
99 std::this_thread::sleep_for(std::chrono::microseconds(50));
100 timeout_us -= 50;
101 } else {
102 return false;
103 }
104 }
105 return false;
106}
const uint32_t kBufLength
uint32_t seq
Sequence number of message