Skip to content

Instantly share code, notes, and snippets.

@laacz
Created August 23, 2011 18:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save laacz/1166129 to your computer and use it in GitHub Desktop.
Save laacz/1166129 to your computer and use it in GitHub Desktop.
Jāmet pie malas...
<?php
$worker= new GearmanWorker();
$worker->addServer('gms');
/* .. whiskas .. */
$worker->addFunction("die", "harikiri");
function harikiri($bushido = false) {
static $seppuku = false;
$seppuku = $bushido ? true : $seppuku;
return $seppuku;
}
while (!harikiri()) {
$worker->work();
if ($worker->returnCode() != GEARMAN_SUCCESS) {
harikiri(true);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment