Skip to content

Commit

Permalink
Fix wait argument in configuration example (#5106)
Browse files Browse the repository at this point in the history
Signed-off-by: Denisa <[email protected]>
Co-authored-by: Denisa <[email protected]>
  • Loading branch information
depink5 and depink5 authored Jul 29, 2024
1 parent fc2fb99 commit bb3a056
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions examples/cpp/configuration/CLIParser.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -852,10 +852,10 @@ class CLIParser
try
{
int input = std::stoi(argv[i]);
if (input < 1 || static_cast<long>(input) > static_cast<long>(max_duration))
if (input < 0 || static_cast<long>(input) > static_cast<long>(max_duration))
{
throw std::out_of_range("wait argument " + std::string(
argv[i]) + " out of range [1, " + std::to_string(
argv[i]) + " out of range [0, " + std::to_string(
max_duration) + "].");
}
else
Expand Down
4 changes: 2 additions & 2 deletions examples/cpp/configuration/PublisherApp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -268,8 +268,8 @@ bool PublisherApp::publish()
std::unique_lock<std::mutex> matched_lock(mutex_);
cv_.wait(matched_lock, [&]()
{
// at least one has been discovered
return ((matched_ > 0) || is_stopped());
// Publisher starts sending messages when enough entities have been discovered.
return ((matched_ >= static_cast<int16_t>(wait_)) || is_stopped());
});
if (!is_stopped())
{
Expand Down

0 comments on commit bb3a056

Please sign in to comment.