Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@kazuho
Copy link
Member

@kazuho kazuho commented Feb 7, 2022

#2017 introduced use of pthread_setaffinity_np on linux, and #2574 extended that to NetBSD. So far, we have relied on CHECK_C_SOURCE_COMPILES to detect the availability of the feature.

However, that has led to issues on FreeBSD: see #2933 and #2934.

In reality, feature detection using duck-typing (compile some code, and if that succeeds, assume that the API can be used) works only if support for an API is provided in a consistent way between platforms that support that API.

This is not the case for phread_setaffinity_np. Linux uses cpu_set_t. FreeBSD uses cpuset_t. NetBSD uses cpuset_t, but requires applications to allocate the structure on heap using API.

Considering the fact that we have to have different code for each platform, it is simpler to just to #if platform in the source files directly.

dch and others added 2 commits February 7, 2022 13:01
…ts.txt) does not work well for `pthread_setaffinity_np` which has different related API on each platform
@kazuho kazuho requested a review from dch February 7, 2022 06:41
@kazuho
Copy link
Member Author

kazuho commented Feb 7, 2022

@dch I've tested this PR and it works well on FreeBSD 13. PTAL.

Copy link
Collaborator

@dch dch left a comment

Choose a reason for hiding this comment

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

thanks! checked on 13.0-RELEASE, 14.0-CURRENT for both amd64 and arm64 platforms. 🚀 🎭

@kazuho kazuho merged commit 34a5ac2 into master Feb 8, 2022
@kazuho
Copy link
Member Author

kazuho commented Feb 8, 2022

Thank you for checking. Merged.

@dch
Copy link
Collaborator

dch commented Feb 8, 2022

thanks! @utrenkner FYI merged to FreeBSD ports

closes #2933
closes #2934

@dch
Copy link
Collaborator

dch commented Feb 9, 2022

unfortunately there are commits merged in before this that re-break FreeBSD again. See #2944 and https://git.sr.ht/~dch/ports/commit/f950dbc for minimal patch.

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.

3 participants