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

Stop storing the context in the guard condition. #2400

Merged
merged 2 commits into from
Jan 8, 2024

Commits on Jan 3, 2024

  1. Add in a test for context getting shutdown.

    Signed-off-by: Chris Lalancette <[email protected]>
    clalancette committed Jan 3, 2024
    Configuration menu
    Copy the full SHA
    01cd677 View commit details
    Browse the repository at this point in the history
  2. Stop storing the context in the guard condition.

    This was creating a circular reference between GuardCondition
    and Context, so that Context would never be cleaned up.
    Since we never really need the GuardCondition to know
    about its own Context, remove that part of the circular
    reference.
    
    While we are in here, we also change the get_context()
    lambda to a straight weak_ptr; there is no reason for the
    indirection since the context for the guard condition
    cannot change at runtime.
    
    We also remove the deprecated version of the
    get_notify_guard_condition().  That's because there is
    no way to properly implement it in the new scheme, and
    it seems to be unused outside of rclcpp.
    
    Finally, we add in a test that guarantees the use_count
    is what we expect when inside and leaving a scope, ensuring
    that contexts will properly be destroyed.
    
    Signed-off-by: Chris Lalancette <[email protected]>
    clalancette committed Jan 3, 2024
    Configuration menu
    Copy the full SHA
    6c1f6a4 View commit details
    Browse the repository at this point in the history