Skip to content

add thread naming utilities #213

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

Open
wants to merge 5 commits into
base: rolling
Choose a base branch
from

Conversation

Aposhian
Copy link

Description

Moved thread naming utilities from ros2/rclcpp#2871.

Fixes ros2/rclcpp#2818

Is this user-facing behavior change?

No, just new interfaces.

Did you use Generative AI?

Yes. Cursor autocomplete.

Additional Information

Signed-off-by: Adam Aposhian <adam.aposhian@fireflyautomatix.com>

// This includes the null terminator
#if defined(__APPLE__)
constexpr size_t MAXTHREADNAMESIZE = 64;
Copy link
Contributor

Choose a reason for hiding this comment

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

include <cstddef>

Copy link
Author

@Aposhian Aposhian Jun 17, 2025

Choose a reason for hiding this comment

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

  • add include for size_t

std::error_code error_code(result, std::system_category());
throw std::system_error(error_code, "Failed to get thread name");
}
std::wstringstream wss;
Copy link
Contributor

Choose a reason for hiding this comment

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

include <sstream>

Copy link
Author

Choose a reason for hiding this comment

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

It is included, but only on windows.


std::string get_thread_name()
{
std::string name;
Copy link
Contributor

Choose a reason for hiding this comment

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

include <string>

Copy link
Author

@Aposhian Aposhian Jun 17, 2025

Choose a reason for hiding this comment

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

  • add string include to cpp

Aposhian added 3 commits June 17, 2025 11:01
Signed-off-by: Adam Aposhian <adam.aposhian@fireflyautomatix.com>
Signed-off-by: Adam Aposhian <adam.aposhian@fireflyautomatix.com>
Signed-off-by: Adam Aposhian <adam.aposhian@fireflyautomatix.com>
@Aposhian Aposhian force-pushed the 2818-custom-thread-names branch from 230621f to 2a2a955 Compare June 17, 2025 17:03
Signed-off-by: Adam Aposhian <adam.aposhian@fireflyautomatix.com>
@Aposhian
Copy link
Author

I finally got my Windows development environment up, so I was able to test, and now this compiles and tests pass on Windows. I have still not tested on Apple

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.

Adding custom thread names to component_container_isolated
2 participants