Skip to content

Proper spin_some behaviour on EventsExecutor#46

Merged
irobot-ros merged 4 commits intoirobot-ros:irobot/add-events-executorfrom
mauropasse:mauro/fix-spin-some-events-executor
Feb 19, 2021
Merged

Proper spin_some behaviour on EventsExecutor#46
irobot-ros merged 4 commits intoirobot-ros:irobot/add-events-executorfrom
mauropasse:mauro/fix-spin-some-events-executor

Conversation

@mauropasse
Copy link
Copy Markdown
Collaborator

No description provided.

auto timepoint_timer_ready = std::chrono::steady_clock::now() + head->time_until_trigger();

// Here we check if the timer was already ready at timepoint
timer_ready = timepoint_timer_ready < timepoint;
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

there is already a function that performs this check: timer_was_ready_at_tp

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done feef4e2

// See https://en.cppreference.com/w/cpp/thread/condition_variable/wait_for
static constexpr std::chrono::nanoseconds MAX_TIME = std::chrono::hours(90);

using TimePoint = std::chrono::time_point<std::chrono::steady_clock>;
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this should not be public
moreover, if you want to use an alias, you should replace it in all the functions

*/
bool execute_head_timer();
bool execute_head_timer(
std::chrono::time_point<std::chrono::steady_clock> tp = TimePoint::max());
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the signature of this function is not correct because std::chrono::time_point<std::chrono::steady_clock> and TimePoint may be different types.

@irobot-ros irobot-ros merged commit bb491bd into irobot-ros:irobot/add-events-executor Feb 19, 2021
@mauropasse mauropasse deleted the mauro/fix-spin-some-events-executor branch February 19, 2021 18:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants