@@ -50,7 +50,6 @@ private:
void died(int wstatus);
pid_t pid_;
- bool running_;
enum ExitStatus exitStatus_;
int exitCode_;
@@ -208,7 +208,7 @@ const struct sigaction &ProcessManager::oldsa() const
*/
Process::Process()
- : pid_(-1), running_(false), exitStatus_(NotExited), exitCode_(0)
+ : pid_(-1), exitStatus_(NotExited), exitCode_(0)
{
}
@@ -240,7 +240,7 @@ int Process::start(const std::string &path,
{
int ret;
- if (running_)
+ if (pid_ > 0)
return 0;
int childPid = fork();
@@ -252,8 +252,6 @@ int Process::start(const std::string &path,
pid_ = childPid;
ProcessManager::instance()->registerProcess(this);
- running_ = true;
-
return 0;
} else {
if (isolate())
@@ -327,7 +325,7 @@ int Process::isolate()
*/
void Process::died(int wstatus)
{
- running_ = false;
+ pid_ = -1;
exitStatus_ = WIFEXITED(wstatus) ? NormalExit : SignalExit;
exitCode_ = exitStatus_ == NormalExit ? WEXITSTATUS(wstatus) : -1;