launch_daemon: Fixed the remaining "operation not allowed" bug.
* This was the harmless part: a job was been requeued that already was being launched. * I was already aware of this one, and only accidentally stumbled over the non-harmless case in the JobQueue code when I tried to fix that little issue... (ie. never ignore warnings, even if you think you know what's going on).
This commit is contained in:
parent
c80084b025
commit
4ae4b3ff57
|
@ -25,6 +25,7 @@ Job::Job(const char* name)
|
||||||
fEnabled(true),
|
fEnabled(true),
|
||||||
fService(false),
|
fService(false),
|
||||||
fCreateDefaultPort(false),
|
fCreateDefaultPort(false),
|
||||||
|
fLaunching(false),
|
||||||
fInitStatus(B_NO_INIT),
|
fInitStatus(B_NO_INIT),
|
||||||
fTeam(-1),
|
fTeam(-1),
|
||||||
fLaunchStatus(B_NO_INIT),
|
fLaunchStatus(B_NO_INIT),
|
||||||
|
@ -349,6 +350,20 @@ Job::IsRunning() const
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool
|
||||||
|
Job::IsLaunching() const
|
||||||
|
{
|
||||||
|
return fLaunching;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
Job::SetLaunching(bool launching)
|
||||||
|
{
|
||||||
|
fLaunching = launching;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
status_t
|
status_t
|
||||||
Job::HandleGetLaunchData(BMessage* message)
|
Job::HandleGetLaunchData(BMessage* message)
|
||||||
{
|
{
|
||||||
|
@ -376,10 +391,12 @@ Job::Run()
|
||||||
status_t
|
status_t
|
||||||
Job::Execute()
|
Job::Execute()
|
||||||
{
|
{
|
||||||
|
status_t status = B_OK;
|
||||||
if (!IsLaunched() || !IsService())
|
if (!IsLaunched() || !IsService())
|
||||||
return Launch();
|
status = Launch();
|
||||||
|
|
||||||
return B_OK;
|
fLaunching = false;
|
||||||
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -73,6 +73,9 @@ public:
|
||||||
bool IsLaunched() const;
|
bool IsLaunched() const;
|
||||||
bool IsRunning() const;
|
bool IsRunning() const;
|
||||||
|
|
||||||
|
bool IsLaunching() const;
|
||||||
|
void SetLaunching(bool launching);
|
||||||
|
|
||||||
status_t HandleGetLaunchData(BMessage* message);
|
status_t HandleGetLaunchData(BMessage* message);
|
||||||
|
|
||||||
virtual status_t Run();
|
virtual status_t Run();
|
||||||
|
@ -104,6 +107,7 @@ private:
|
||||||
bool fEnabled;
|
bool fEnabled;
|
||||||
bool fService;
|
bool fService;
|
||||||
bool fCreateDefaultPort;
|
bool fCreateDefaultPort;
|
||||||
|
bool fLaunching;
|
||||||
PortMap fPortMap;
|
PortMap fPortMap;
|
||||||
status_t fInitStatus;
|
status_t fInitStatus;
|
||||||
team_id fTeam;
|
team_id fTeam;
|
||||||
|
|
|
@ -1074,7 +1074,7 @@ LaunchDaemon::_LaunchJobs(Target* target, bool forceNow)
|
||||||
void
|
void
|
||||||
LaunchDaemon::_LaunchJob(Job* job, uint32 options)
|
LaunchDaemon::_LaunchJob(Job* job, uint32 options)
|
||||||
{
|
{
|
||||||
if (job == NULL || (job->IsService() && job->IsLaunched())
|
if (job == NULL || job->IsLaunching() || job->IsRunning()
|
||||||
|| ((options & FORCE_NOW) == 0
|
|| ((options & FORCE_NOW) == 0
|
||||||
&& (!job->EventHasTriggered() || !job->CheckCondition(*this)
|
&& (!job->EventHasTriggered() || !job->CheckCondition(*this)
|
||||||
|| ((options & TRIGGER_DEMAND) != 0
|
|| ((options & TRIGGER_DEMAND) != 0
|
||||||
|
@ -1097,6 +1097,7 @@ LaunchDaemon::_LaunchJob(Job* job, uint32 options)
|
||||||
if (job->Event() != NULL)
|
if (job->Event() != NULL)
|
||||||
job->Event()->ResetTrigger();
|
job->Event()->ResetTrigger();
|
||||||
|
|
||||||
|
job->SetLaunching(true);
|
||||||
fJobQueue.AddJob(job);
|
fJobQueue.AddJob(job);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue