예제 #1
0
<?php

require_once __DIR__ . "/../../share/include/cherryphp";
use Cherry\Core\ObjectManager as ObjMan;
use Cherry\Core\IObjectManagerInterface;
use Cherry\Core\ServiceManager as SvcMan;
use Cherry\Core\ServiceInstance;
// We need to call on this to make sure the service manager is registered
SvcMan::register();
/**
 * TestService: This service does nothing but print dots until it is stopped.
 */
class TestService extends ServiceInstance
{
    public $serviceid = "info.noccylabs.testservice";
    public function __construct()
    {
        $this->flags = ServiceInstance::SVC_RESTART + ServiceInstance::SVC_NO_DELAY;
    }
    function servicemain()
    {
        for ($s = 0; $s < 5; $s++) {
            usleep(100000);
            echo ".";
        }
    }
    function servicehalt()
    {
        echo "X\n";
    }
}