MCPcopy Create free account
hub / github.com/arjunskumar/Robotics_CPP_Notes / push

Method push

capstone/sensor_pipeline.hpp:38–48  ·  view source on GitHub ↗

Producer: push with bounded blocking

Source from the content-addressed store, hash-verified

36public:
37 // Producer: push with bounded blocking
38 bool push(const T& item) {
39 std::unique_lock<std::mutex> lock(mux_);
40 cv_space_.wait(lock, [this] { return count_ < N || !active_; });
41 if (!active_) return false;
42
43 buffer_[(head_ + count_) % N] = item;
44 ++count_;
45 lock.unlock();
46 cv_data_.notify_one();
47 return true;
48 }
49
50 // Consumer: pop with blocking wait (Module 08: std::optional)
51 [[nodiscard]] std::optional<T> pop() {

Callers 2

producerLoopMethod · 0.80
TESTFunction · 0.80

Calls

no outgoing calls

Tested by 1

TESTFunction · 0.64