-
Notifications
You must be signed in to change notification settings - Fork 15
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
Implement SetThreadPriority #786
Conversation
@gittyupagain implemented this functionality on a private branch awhile back, let's get it into mainline.
default: | ||
throw std::runtime_error("Attempted to assign an unrecognized thread priority"); | ||
} | ||
param.sched_priority = PTHREAD_MIN_PRIORITY + (percent*(PTHREAD_MAX_PRIORITY - PTHREAD_MIN_PRIORITY) + 50) / 100; |
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.
#include <sched.h>
int sched_get_priority_max(int policy);
int sched_get_priority_min(int policy);
should be used here.
e399eea
to
c480b3e
Compare
#define PTHREAD_MIN_PRIORITY 0 | ||
#endif | ||
#if !defined(PTHREAD_MAX_PRIORITY) | ||
#define PTHREAD_MAX_PRIORITY 31 |
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.
It looks like 63 is max priority in user space according to https://developer.apple.com/library/mac/documentation/Darwin/Conceptual/KernelProgramming/scheduler/scheduler.html.
Why did you put 31?
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.
This was done 20 months ago and never pushed. It was an initial attempt at the problem. Those numbers probably came from Linux documentation. It is unfortunate that it isn't defined. If 63 is correct, then that should be used instead.
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.
I'll make the change.
Implement SetThreadPriority
@gittyupagain implemented this functionality on a private branch awhile back, let's get it into mainline.
Fixes #784