Ejemplo n.º 1
0
int ll_daemon_stop(const char *lockfile, const char *pidfile)
{
pid_t	p, p2;
int	waitstat;

	/*
	** We fork, and the child process attempts to stop the daemon,
	** then communicates the success to us, via its exit code.
	*/

	signal(SIGCHLD, SIG_DFL);
	if ((p=fork()) == -1)
	{
		perror("fork");
		return (1);
	}
	if (p == 0)	stop1(lockfile, pidfile);

	while ((p2=wait(&waitstat)) != p)
		;

	if (WIFEXITED(waitstat))
		return (WEXITSTATUS(waitstat));
	return (0);
}
Ejemplo n.º 2
0
//----------------------------------------------------------------------------
const ctkRuntimeException* ctkPluginPrivate::stop0()
{
  wasStarted = state == ctkPlugin::ACTIVE;
  // 5:
  state = ctkPlugin::STOPPING;
  operation.fetchAndStoreOrdered(DEACTIVATING);
  // 6-13:
  // TODO plugin threading
  //const ctkRuntimeException* savedException = pluginThread().callStop1(this);
  const ctkRuntimeException* savedException = stop1();
  if (state != ctkPlugin::UNINSTALLED)
  {
    state = ctkPlugin::RESOLVED;
    // TODO plugin threading
    //bundleThread().bundleChanged(new BundleEvent(BundleEvent.STOPPED, this));
    fwCtx->listeners.emitPluginChanged(ctkPluginEvent(ctkPluginEvent::STOPPED, this->q_func()));

    operationLock.wakeAll();
    operation.fetchAndStoreOrdered(IDLE);
  }
  return savedException;
}