-
Notifications
You must be signed in to change notification settings - Fork 229
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Make rclpy initialization context-manager aware. (#1298)
* Make rclpy initialization context-manager aware. This PR does two somewhat controversial things: 1. It switches to an intermediate object for initialization. That way we can use context managers, but actually properly clean up, including uninstalling signal handlers. We also switch to tracking node resources in the context, so that when the context goes away, all nodes associated with it are automatically destroyed. 2. It changes the context manager implementation of Context so that it warns if the context did not have init() called before entering the context. This definitely changes the semantics, but as it stands that initialization doesn't make sense because it can't take arguments. I think this change is warranted, though we may have to search through documentation and examples to make sure this doesn't break anything. Signed-off-by: Chris Lalancette <[email protected]> Co-authored-by: Shane Loretz <[email protected]>
- Loading branch information
1 parent
582a569
commit cef4ce9
Showing
5 changed files
with
121 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters