add a one-line method for resetting a job lock

This commit is contained in:
jinjunzh 2022-07-08 12:09:58 -04:00
parent 7a3c21174d
commit 7eb71143db
2 changed files with 4 additions and 2 deletions

View File

@ -40,7 +40,7 @@ DeflateJobHWPool::DeflateJobHWPool():log(&Poco::Logger::get("DeflateJobHWPool"))
if ((nullptr == qpl_job_ptr) || (qpl_init_job(PATH, qpl_job_ptr) != QPL_STS_OK))
break;
jobPool[index] = qpl_job_ptr;
jobLocks[index].store(false);
unLockJob(index);
}
const char * qpl_version = qpl_get_library_version();
@ -66,7 +66,7 @@ DeflateJobHWPool::~DeflateJobHWPool()
qpl_fini_job(jobPool[i]);
}
jobPool[i] = nullptr;
jobLocks[i].store(false);
unLockJob(i);
}
jobPoolReady() = false;
}

View File

@ -81,6 +81,8 @@ private:
return jobLocks[index].compare_exchange_strong(expected, true);
}
void unLockJob(uint32_t index) { jobLocks[index].store(false); }
class ReleaseJobObjectGuard
{
uint32_t index;