com php-src: Remove support for REALTIME_PRIORITY_CLASS i n proc_nice() on Windows.: ext/standard/tests /general_functions/proc_nice_basic-win.phpt
win32 /nice.c
| From: | Kalle Sommer Nielsen | Date: | Fri, 18 Nov 2016 23:32:07 +0000 |
| Subject: | com php-src: Remove support for REALTIME_PRIORITY_CLASS i n proc_nice() on Windows.: ext/standard/tests /general_functions/proc_nice_basic-win.phpt win32 /nice.c |
||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-95881@lists.php.net to get a copy of this message | ||
Commit: ddf95667c432a3088fc6d176f4d9d719baaca20c
Author: Kalle Sommer Nielsen <kalle@php.net> Sat, 19 Nov 2016 00:32:07 +0100
Parents: 271ed78a31e9f8c0658f3ba40e82c09b26ccca3a
Branches: master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=ddf95667c432a3088fc6d176f4d9d719baaca20c
Log:
Remove support for REALTIME_PRIORITY_CLASS in proc_nice() on Windows.
The reasoning for this is because that it requires special permissions and can in the end be
dangerous, discovered by Anatol.
Changed paths:
M ext/standard/tests/general_functions/proc_nice_basic-win.phpt
M win32/nice.c
Diff:
diff --git a/ext/standard/tests/general_functions/proc_nice_basic-win.phpt
b/ext/standard/tests/general_functions/proc_nice_basic-win.phpt
index 232389f..157ad74 100644
--- a/ext/standard/tests/general_functions/proc_nice_basic-win.phpt
+++ b/ext/standard/tests/general_functions/proc_nice_basic-win.phpt
@@ -75,8 +75,7 @@ $p = [
'Below normal' => [6, 5],
'Normal' => [8, 0],
'Above normal' => [10, -5],
- 'High priority' => [13, -10],
- 'Real time' => [24, -16]
+ 'High priority' => [13, -10]
];
foreach ($p as $test => $data) {
@@ -93,4 +92,3 @@ Testing 'Below normal' (5): Passed
Testing 'Normal' (0): Passed
Testing 'Above normal' (-5): Passed
Testing 'High priority' (-10): Passed
-Testing 'Real time' (-16): Passed
diff --git a/win32/nice.c b/win32/nice.c
index db26cc1..202a4d8 100644
--- a/win32/nice.c
+++ b/win32/nice.c
@@ -30,8 +30,6 @@
* +-----------------------+-----------------------------+
* | Expression | Priority type |
* +-----------------------+-----------------------------+
- * | priority < -14 | REALTIME_PRIORITY_CLASS |
- * +-----------------------+-----------------------------+
* | priority < -9 | HIGH_PRIORITY_CLASS |
* +-----------------------+-----------------------------+
* | priority < -4 | ABOVE_NORMAL_PRIORITY_CLASS |
@@ -48,15 +46,15 @@
*
* This is applied to the main process, not per thread, although this could
* be implemented using SetThreadPriority() at one point.
+ *
+ * Note, it is intended that some priority classes are left out.
*/
PHPAPI int nice(zend_long p)
{
DWORD dwFlag = NORMAL_PRIORITY_CLASS;
- if (p < -14) {
- dwFlag = REALTIME_PRIORITY_CLASS;
- } else if (p < -9) {
+ if (p < -9) {
dwFlag = HIGH_PRIORITY_CLASS;
} else if (p < -4) {
dwFlag = ABOVE_NORMAL_PRIORITY_CLASS;