Improved JobObject::addProcessToJob() function.
This commit is contained in:
parent
052bdf4ec7
commit
7ed2c7e5ce
@ -72,21 +72,38 @@ JobObject::~JobObject(void)
|
||||
|
||||
bool JobObject::addProcessToJob(const QProcess *proc)
|
||||
{
|
||||
if(m_hJobObject)
|
||||
if(!m_hJobObject)
|
||||
{
|
||||
if(AssignProcessToJobObject(m_hJobObject, proc->pid()->hProcess))
|
||||
qWarning("Cannot assign process to job: No job bject available!");
|
||||
return false;
|
||||
}
|
||||
|
||||
if(Q_PID pid = proc->pid())
|
||||
{
|
||||
DWORD exitCode;
|
||||
if(!GetExitCodeProcess(pid->hProcess, &exitCode))
|
||||
{
|
||||
return true;
|
||||
qWarning("Cannot assign process to job: Failed to query process status!");
|
||||
return false;
|
||||
}
|
||||
else
|
||||
|
||||
if(exitCode != STILL_ACTIVE)
|
||||
{
|
||||
qWarning("Cannot assign process to job: Process is not running anymore!");
|
||||
return false;
|
||||
}
|
||||
|
||||
if(!AssignProcessToJobObject(m_hJobObject, pid->hProcess))
|
||||
{
|
||||
qWarning("Failed to assign process to job object!");
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
qWarning("Cannot assign process to job: No job bject available!");
|
||||
qWarning("Cannot assign process to job: Process handle not available!");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -1359,13 +1359,8 @@ bool EncodeThread::startProcess(QProcess &process, const QString &program, const
|
||||
|
||||
if(process.waitForStarted())
|
||||
{
|
||||
Q_PID pid = process.pid();
|
||||
if((pid != NULL) && (m_jobObject != NULL))
|
||||
{
|
||||
m_jobObject->addProcessToJob(&process);
|
||||
x264_change_process_priority(&process, m_processPriority);
|
||||
}
|
||||
|
||||
m_jobObject->addProcessToJob(&process);
|
||||
x264_change_process_priority(&process, m_processPriority);
|
||||
lock.unlock();
|
||||
return true;
|
||||
}
|
||||
|
@ -22,7 +22,7 @@
|
||||
#define VER_X264_MAJOR 2
|
||||
#define VER_X264_MINOR 2
|
||||
#define VER_X264_PATCH 4
|
||||
#define VER_X264_BUILD 606
|
||||
#define VER_X264_BUILD 608
|
||||
|
||||
#define VER_X264_MINIMUM_REV 2363
|
||||
#define VER_X264_CURRENT_API 140
|
||||
|
Loading…
Reference in New Issue
Block a user