Currently, there is no way to access the thread ID of the internal thread used by Asio for DNS resolution. This information could be valuable for debugging, logging, or performance analysis.
Current Behavior
Asio creates internal threads for certain operations, including name resolution. These threads perform DNS lookups asynchronously, but their thread IDs are not exposed through the public API.
Desired Behavior
It would be beneficial to have a method to retrieve the thread ID of the internal resolver thread. This could be implemented as:
A new method in the ip::tcp::resolver class
A property of the io_context that manages these threads
A callback that provides this information when a resolver operation is initiated
Use Case
Access to this thread ID would allow developers to:
Track and log which thread is handling DNS resolutions
Set CPU affinity for these threads if desired
Questions
Is there a technical reason why this information is not currently exposed?
Additional Context
This limitation was discovered while attempting to track all threads involved in network operations within an application using Asio.
Description
Currently, there is no way to access the thread ID of the internal thread used by Asio for DNS resolution. This information could be valuable for debugging, logging, or performance analysis.
Current Behavior
Asio creates internal threads for certain operations, including name resolution. These threads perform DNS lookups asynchronously, but their thread IDs are not exposed through the public API.
Desired Behavior
It would be beneficial to have a method to retrieve the thread ID of the internal resolver thread. This could be implemented as:
A new method in the
ip::tcp::resolver
class A property of theio_context
that manages these threads A callback that provides this information when a resolver operation is initiatedUse Case
Access to this thread ID would allow developers to:
Track and log which thread is handling DNS resolutions Set CPU affinity for these threads if desired
Questions
Is there a technical reason why this information is not currently exposed?
Additional Context
This limitation was discovered while attempting to track all threads involved in network operations within an application using Asio.