Skip to content

replace detached spin thread with std::jthread#200

Open
ahcorde wants to merge 4 commits into
rollingfrom
ahcorde/rolling/datarace_jthread
Open

replace detached spin thread with std::jthread#200
ahcorde wants to merge 4 commits into
rollingfrom
ahcorde/rolling/datarace_jthread

Conversation

@ahcorde

@ahcorde ahcorde commented Jun 12, 2026

Copy link
Copy Markdown
Contributor

replaced teleop's detached spin thread and made running atomic, fixing a shutdown use-after-free race and signal-handle

@asymingt FYI

Claude Opus 4.7

ahcorde added 3 commits June 12, 2026 12:16
Signed-off-by: Alejandro Hernandez Cordero <ahcorde@gmail.com>
Signed-off-by: Alejandro Hernandez Cordero <ahcorde@gmail.com>
Signed-off-by: Alejandro Hernandez Cordero <ahcorde@gmail.com>
@ahcorde ahcorde self-assigned this Jun 12, 2026
@ahcorde

ahcorde commented Jun 22, 2026

Copy link
Copy Markdown
Contributor Author

friendly ping @asymingt

char c;

std::thread{std::bind(&TeleopTurtle::spin, this)}.detach();
// Spin the node on a background thread. std::jthread joins automatically

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Claude is explaining the change it made to you via this comment. To be committed into the code it needs to add texture to what's implemented in the current code revision. So, please remove the unlike the previous detach() which raced shutdown from this comment.

@mergify

mergify Bot commented Jun 22, 2026

Copy link
Copy Markdown
Contributor

Tick the box to add this pull request to the merge queue (same as @mergifyio queue).

  • Queue this pull request

Base automatically changed from ahcorde/rolling/cpp20 to rolling June 23, 2026 13:00
@ahcorde ahcorde requested a review from asymingt June 23, 2026 13:02
@ahcorde

ahcorde commented Jun 23, 2026

Copy link
Copy Markdown
Contributor Author

Pulls: #200
Gist: https://gist.githubusercontent.com/ahcorde/7e788c4e49d220c8ea64bd42398ae58c/raw/1906cb233b10348884e9ef0f9cae8582df5aea13/ros2.repos
BUILD args: --packages-above-and-dependencies turtlesim
TEST args: --packages-above turtlesim
ROS Distro: rolling
Job: ci_launcher
ci_launcher ran: https://ci.ros2.org/job/ci_launcher/19652

  • Linux Build Status
  • Linux-aarch64 Build Status
  • Linux-rhel Build Status
  • Windows Build Status

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