[FreeBSD] use pthread_setaffinity_np #2942
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
#2017 introduced use of
pthread_setaffinity_npon linux, and #2574 extended that to NetBSD. So far, we have relied onCHECK_C_SOURCE_COMPILESto 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 usescpu_set_t. FreeBSD usescpuset_t. NetBSD usescpuset_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 platformin the source files directly.