-
Notifications
You must be signed in to change notification settings - Fork 7.9k
ext/pcntl: cpu affinity api introduction. #13893
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
Conversation
cc65a36
to
fa2077b
Compare
For now, working on Linux, FreeBSD >= 13.x and DragonFlyBSD. Handy wrapper to assign an array of cpu ids or to retrieve the cpu ids assigned to a given process. pcntl_setaffinity inserts valid unique cpu ids (within the range of available cpus).
fa2077b
to
5f7e7ba
Compare
afed2bf
to
7b9d1d9
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the changes, here's another review round.
7b9d1d9
to
d1bce65
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks almost good, final nits.
6cd94c1
to
b7e805a
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thanks!
ext/pcntl/pcntl.c
Outdated
if (Z_TYPE_P(ncpu) == IS_STRING) { | ||
zend_ulong tmp; | ||
if (!ZEND_HANDLE_NUMERIC(Z_STR_P(ncpu), tmp)) { | ||
zend_argument_value_error(2, "cpu id invalid type (%s)", ZSTR_VAL(Z_STR_P(ncpu))); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps the wording could be a bit better because now it sounds like the type is the value of the string, but this works too and does not block the PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for your review !
addressing other remarks.
b7e805a
to
866fbc2
Compare
For now, working on Linux, FreeBSD >= 13.x and DragonFlyBSD. Handy wrapper to assign an array of cpu ids or to retrieve the cpu ids assigned to a given process.
pcntl_setaffinity inserts valid unique cpu ids (within the range of available
cpus).