cameron314 / cameron314/concurrentqueue
First try_queue return 1 always
Open
Nobody has claimed this yet.
- Dominant language
- C++
- Stars
- 12.5k
- Forks
- 1.9k
- PR merge metrics
- No merged PRs in 30d
Description
ConcurrentQueue define as :
moodycamel::ConcurrentQueue<uint64_t> clocks_;
Enqueue thread:
while (curr_clock_time < end_clock_time && !stop_) {
SINFO("ENQUEUE CLOCK: {}", curr_clock_time);
while (!clocks_.try_enqueue(curr_clock_time)) {
std::this_thread::sleep_for(std::chrono::nanoseconds(options_.precision));
}
curr_clock_time += step;
}
Dequeue thread:
while (timestamp > clock_time && clocks_.size_approx() > 0) {
auto msg = rosgraph_msgs::msg::Clock();
msg.clock.sec = static_cast<int32_t>(clock_time / 1e9);
msg.clock.nanosec = static_cast<uint32_t>(clock_time % static_cast<uint64_t>(1e9));
SINFO("DEQUEUE CLOCK: {}", clock_time);
clock_writer_->publish(msg);
while (!clocks_.try_dequeue(clock_time) && clocks_.size_approx() > 0) {
std::this_thread::sleep_for(std::chrono::nanoseconds(options_.precision));
}
}
First clock_time get by try_dequeue always is 1.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
No source file or test is named. Start by building a minimal reproduction from the enqueue and dequeue snippets, then inspect the try_dequeue and size_approx usage against the queue's documented behavior. Done means a reproducible explanation of the first value and a confirmed expected dequeue sequence.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- distributed-systems
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100