MCPcopy Create free account
hub / github.com/AutonomousFieldRoboticsLab/SVIn / push

Method push

pose_graph/include/utils/ThreadSafeQueue.h:273–285  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

271
272template <typename T>
273bool ThreadsafeQueue<T>::push(T new_value) {
274 if (shutdown_) return false; // atomic, no lock needed.
275 std::shared_ptr<T> data(std::make_shared<T>(std::move(new_value)));
276 std::unique_lock<std::mutex> lk(mutex_);
277 data_queue_.push(data);
278 size_t queue_size = data_queue_.size();
279 lk.unlock(); // Unlock before notify.
280 data_cond_.notify_one();
281 // Thread-safe so doesn't need external mutex.
282 if (queue_size_stats_) queue_size_stats_->AddSample(queue_size);
283 VLOG_IF(1, queue_size > 1u) << "Queue with id: " << queue_id_ << " is getting full, size: " << queue_size;
284 return true;
285}
286
287template <typename T>
288bool ThreadsafeQueue<T>::pushBlockingIfFull(T new_value, size_t max_queue_size) {

Callers 7

PushNonBlockingMethod · 0.45
PushBlockingIfFullMethod · 0.45
enqueueMethod · 0.45
addKFToPoseGraphMethod · 0.45
pushBlockingIfFullMethod · 0.45
pushOverflowIfFullMethod · 0.45

Calls 2

sizeMethod · 0.45
AddSampleMethod · 0.45

Tested by

no test coverage detected