Open roncapat opened 1 month ago
@saikishor what do you think?
As I just spent some time with that class: I would recommend against both suggestions and make an alternative proposal:
We make the thread_
field protected and you can inherit from the RealtimePublisher and add whatever functionality you need.
I think this is the cleanest approach as we keep the RealtimePublisher itself free from platform specific code and avoid exposing internals.
Fine for me, as long as I have a way to access the thread handle :)
@roncapat I suggest you create a PR for that ;)
At least in Linux, it is possible to rename a thread, via calls like ptrhead_setname_np.
For application featuring many
RealtimePublishers
and many other threads, diving intoperf record
outputs (e.g. viahotspot
tool) is difficult because by default all threads have the same name (First 15 characters of the process name), and thread renaming is a powerful tool to discriminate at a glance which thread does what.To allow this, either the implementation of
RealtimePublisher
shall permit to obtain the native handle (see this) or may enable for Linux only an additional method that usespthread_setname_np
.I can submit a PR depending on maintainers feedback of course 👍🏻