public function eventCall($arg)
    {
        try {
            if ($this->state === Generic::STATE_FINISHED) {
                $this->finish();
                $this->free();
                return;
            }
            $this->state = Generic::STATE_RUNNING;
            $this->onWakeup();
            $throw = false;
            try {
                $ret = $this->run();
                if (($ret === Generic::STATE_FINISHED) || ($ret === null)) {
                    $this->finish();
                } elseif ($ret === Generic::STATE_WAITING) {
                    $this->state = $ret;
                }
            } catch (RequestSleep $e) {
                $this->state = Generic::STATE_WAITING;
            } catch (RequestTerminated $e) {
                $this->state = Generic::STATE_FINISHED;
            } catch (\Exception $e) {
                if (!$this->handleException($e)) {
                    $throw = true;
                }
            }
            if ($this->state === Generic::STATE_FINISHED) {
                $this->finish();
            }
            $this->onSleep();
            if ($throw) {
                throw $e;
            }
        } catch (\Exception $e) {
            Daemon::uncaughtExceptionHandler($e);
            $this->finish();
            return;
        }
        if ($this->state === Generic::STATE_WAITING) {
            $this->ev->add($this->sleepTime);
        }
    }