Skip to content

rclcpp/context lacking a const method for shutdown_reason #1323

Closed

Description

@Blast545

Adding coverage tests for context module (#1321), we have realized there is no const method for the shutdown_reason method. See link to the code

This issue is to track the conversation here and get some feedback.

Activity

  1. self-assigned this
    on Sep 21, 2020
  2. brawner commented on Sep 21, 2020

    @brawner
    Contributor

    Link to .cpp (

    std::string
    Context::shutdown_reason()
    {
    std::lock_guard<std::recursive_mutex> lock(init_mutex_);
    return shutdown_reason_;
    }
    ). This function requires locking the init_mutex_ which prevents it from being const. I suggested @Blast545 open this issue, just to see if others thought there might be more preferred ways of doing this.

    One possible solution would be to make init_mutex_ and perhaps other mutexes mutable.

  3. removed their assignment
    on Oct 1, 2020
  4. added
    help wanted
    on Oct 15, 2020
  5. suab321321 commented on Feb 21, 2021

    @suab321321
    Contributor

    @clalancette should I follow @brawner and make it the init_mutex_ mutable?
    and open a PR

  6. clalancette commented on Feb 22, 2021

    @clalancette
    Contributor

    @clalancette should I follow @brawner and make it the init_mutex_ mutable?
    and open a PR

    Yeah, that is the usual way to deal with this problem. Making init_mutex_ mutable seems totally reasonable to me.

  7. fujitatomoya commented on Mar 20, 2021

    @fujitatomoya
    Collaborator

    done with #1578

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    help wanted

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions