Skip to content

Instantly share code, notes, and snippets.

@mrkmg
Last active December 17, 2015 01:59
Show Gist options
  • Save mrkmg/5532468 to your computer and use it in GitHub Desktop.
Save mrkmg/5532468 to your computer and use it in GitHub Desktop.
PHP5 snippit to lower threads niceness and then kill the thread when finished.
<?php
proc_nice(19); //Lowers niceness
set_time_limit(0); //Removes timelimit of script
/****
...
Do some very intensive task you do not want to bog down your server
...
****/
posix_kill( getmypid(), 28 ); //Kill current thread
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment