Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

expose rcl timers cancel, reset, is_canceled and is_ready functions. #136

Merged

Conversation

benmaidel
Copy link
Contributor

Exposed useful methods when working with timers.

@hoffmann-stefan hoffmann-stefan force-pushed the feature/expose_timer_functions branch from d51c034 to 8523d4c Compare December 3, 2024 06:49
RCLExceptionHelper.CheckReturnValue(ret, $"{nameof(TimerDelegates.native_rcl_timer_reset)}() failed.");
}

public bool IsCanceled()
Copy link
Member

Choose a reason for hiding this comment

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

Given that ActionServerGoalHandle already defines some similar properties, we should make IsCanceled and IsReady get-only properties.

Normally getters should not throw exception according to the "Framework Design Guidlines".
But the only exception that could rise from this (once IDisposable is implemented) could be the ObjectDisposedException, which is allowed according to https://learn.microsoft.com/en-us/dotnet/fundamentals/code-analysis/quality-rules/ca1065#property-get-methods

Did rebase and push the commit already.

@hoffmann-stefan
Copy link
Member

For some background: This is used in our internal codebase to cancel the timers while doing our shutdown logic. (see #135 (comment) why this doesn't happen automatically with SIGTERM/CTRL-C)

@hoffmann-stefan hoffmann-stefan merged commit e37645f into ros2-dotnet:main Dec 3, 2024
5 checks passed
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