123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081 |
- #include <php.h>
- #include "nice.h"
- PHPAPI int nice(zend_long p)
- {
- DWORD dwFlag = NORMAL_PRIORITY_CLASS;
- if (p < -9) {
- dwFlag = HIGH_PRIORITY_CLASS;
- } else if (p < -4) {
- dwFlag = ABOVE_NORMAL_PRIORITY_CLASS;
- } else if (p > 9) {
- dwFlag = IDLE_PRIORITY_CLASS;
- } else if (p > 4) {
- dwFlag = BELOW_NORMAL_PRIORITY_CLASS;
- }
- if (!SetPriorityClass(GetCurrentProcess(), dwFlag)) {
- return -1;
- }
- return 0;
- }
|