note 125607 deleted from function.proc-nice by cmb
| From: | cmb@php.net | Date: | Wed, 16 Dec 2020 14:01:50 +0000 |
| Subject: | note 125607 deleted from function.proc-nice by cmb | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-215988@lists.php.net to get a copy of this message | ||
Note Submitter: Anonymous
----
// In windows argument has no effect in ranges [-inf, -10], [-9, -5], [-4, 4], [5, 9], [10, inf]
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;
}