Пример #1
0
	void Stop() override {
		TRC(2, "Stopping " << PathDaemon);
		try {
			DBG_LOCAL_IGNORE_CONDITION(errc::connection_refused);

			Call("stop");
		} catch (RCExc) {
			if (m_process)
				m_process.Kill();
		}
	}
Пример #2
0
	void StopOrKill() override {
		try {
			Stop();
			if (m_process)
				m_process.WaitForExit(10000);
		} catch (RCExc DBG_PARAM(ex)) {
			TRC(1, ex.what());
		}
		if (m_process && !m_process.HasExited) {
			try {
				m_process.Kill();
			} catch (RCExc DBG_PARAM(ex)) {
				TRC(1, ex.what());
			}
		}
		TRC(2, "m_process = nullptr");
		m_process = Process();
	}
Пример #3
0
int ProcessPool::WaitAll() {
    // TODO: 完成代码
    int ret = 0;
    ProcessVec::iterator it = processes.end();
    while (it != processes.begin()) {
	it --;
	Process* process = *it;
	if (process->Kill() != 0) {
	    cout << "ProcessPool wait all failed in waitting process "
		 << process->GetId() << endl;
	    ret = -1;
	    break;
	}
	delete process;
	it = processes.erase(it);
    }

    return ret;
}
Пример #4
0
int ProcessPool::KillAll() {
    // TODO: 完成代码
    ProcessVec::iterator it = processes.end();
    while (it != processes.begin()) {
	it --;
	Process* process = *it;
	if (process->Kill() != 0) {
	    cout << "ProcessPool kill all failed in killing process "
		 << process->GetId() << endl;
	    cout << errno << endl;
	    return -1;
	}
	delete process;

	it = processes.erase(it);
    }

    return 0;
}