======setpriority======
WMPRO, WMMINI FW >= 1.0 WMMEGA FW >= 2.0
Set the priority of the current script
====Description====
setpriority (
int
$priority
)
This function can be used to run a script with a higher priority if required. If priority > 0, it will wait till all other scripts are finished before continuing, so that the maximum amount of memory is available to the script.
This will also set [[software:os:config:uphp.ini#max_concurrent_scripts]] to 1 to prevent other scripts from starting while this is set, so make sure to unset the priority by passing a 0 value once you have done your critical processing.
====Parameter====
$priority:
* **= 0** - Normal default priority
* **> 0** - Elevated priority
====Return Values====
None
====Example====
// some code
setpriority(1);
// this will now run exclusively ...
setpriority(0); // back to default priority
?>
====Also See====
[[software:os:config:uphp.ini#max_concurrent_scripts]] - Operating System configuration, uphp.ini: Limit the number of scripts that can run at the same time
[[max_execution_time()]] - Set the maximum execution time for the current script
[[process_list()]] - Return an array of the currently running scripts