Skip to content

Commit bb3a056

Browse files
authored
Fix wait argument in configuration example (#5106)
Signed-off-by: Denisa <denisa@eprosima.com> Co-authored-by: Denisa <denisa@eprosima.com>
1 parent fc2fb99 commit bb3a056

2 files changed

Lines changed: 4 additions & 4 deletions

File tree

examples/cpp/configuration/CLIParser.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -852,10 +852,10 @@ class CLIParser
852852
try
853853
{
854854
int input = std::stoi(argv[i]);
855-
if (input < 1 || static_cast<long>(input) > static_cast<long>(max_duration))
855+
if (input < 0 || static_cast<long>(input) > static_cast<long>(max_duration))
856856
{
857857
throw std::out_of_range("wait argument " + std::string(
858-
argv[i]) + " out of range [1, " + std::to_string(
858+
argv[i]) + " out of range [0, " + std::to_string(
859859
max_duration) + "].");
860860
}
861861
else

examples/cpp/configuration/PublisherApp.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -268,8 +268,8 @@ bool PublisherApp::publish()
268268
std::unique_lock<std::mutex> matched_lock(mutex_);
269269
cv_.wait(matched_lock, [&]()
270270
{
271-
// at least one has been discovered
272-
return ((matched_ > 0) || is_stopped());
271+
// Publisher starts sending messages when enough entities have been discovered.
272+
return ((matched_ >= static_cast<int16_t>(wait_)) || is_stopped());
273273
});
274274
if (!is_stopped())
275275
{

0 commit comments

Comments
 (0)