Skip to content
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

[core] Detect pthread_getname* availability #2111

Merged

Conversation

maxsharabayko
Copy link
Collaborator

@maxsharabayko maxsharabayko commented Aug 31, 2021

  1. Extracted pthread_getname_np() related changes from PR Fix Build for MacOS, FreeBSD, GCC earlier than 4.7, and Clang earlier… #2104 (by @jlsantiago0).

    • Detect availability of pthread_getname_np() and pthread_setname_np() functions in CMake.
    • Use the pthread_getname_np() and pthread_setname_np() functions if available in ThreadName class.
  2. Additional minor change in the second commit: put ThreadName class inside srt namespace.

Original Description by Jose

This fixes MacOS builds for MacOS <10.6 as pthread_getname_np() and pthread_setname_np() was introduced in MacOS 10.6 and is not available in MacOS 10.5 and earlier.

The rework of the pthread_getname_np() and pthread_setname_np() allows other operating systems that support the API to use it. For instance, these functions are available in many of the BSD variants, but maybe in a different header file or may have a slightly different name. I also fixed the handling of the different function call parameters of the Apple and non-Apple implementations of pthread_setname_np(). Apple takes one parameter and most implementations take 2. This was tested with FreeBSD-11.3 and OpenBSD-6.4.

TODO

  • Put ThreadName class inside srt namespace.

@maxsharabayko maxsharabayko added Type: Maintenance Work required to maintain or clean up the code [core] Area: Changes in SRT library core labels Aug 31, 2021
@maxsharabayko maxsharabayko added this to the v1.4.4 milestone Aug 31, 2021
@maxsharabayko maxsharabayko merged commit 5e75c32 into Haivision:master Aug 31, 2021
@maxsharabayko maxsharabayko deleted the develop/pthread_getname_np branch August 31, 2021 15:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[core] Area: Changes in SRT library core Type: Maintenance Work required to maintain or clean up the code
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants