Merge pull request #1585 from dongzha/issue1535New

fix issue #1535 new
This commit is contained in:
ruil2 2014-12-02 15:54:26 +08:00
commit dd24edc8ff

View File

@ -2272,20 +2272,18 @@ void WelsUninitEncoderExt (sWelsEncCtx** ppCtx) {
const int32_t iThreadCount = (*ppCtx)->pSvcParam->iCountThreadsNum;
int32_t iThreadIdx = 0;
if ((*ppCtx)->pSliceThreading->pExitEncodeEvent != NULL) {
while (iThreadIdx < iThreadCount) {
int res = 0;
if ((*ppCtx)->pSliceThreading->pThreadHandles[iThreadIdx]) {
WelsEventSignal (& (*ppCtx)->pSliceThreading->pExitEncodeEvent[iThreadIdx]);
WelsEventSignal (& (*ppCtx)->pSliceThreading->pThreadMasterEvent[iThreadIdx]);
res = WelsThreadJoin ((*ppCtx)->pSliceThreading->pThreadHandles[iThreadIdx]); // waiting thread exit
WelsLog (& (*ppCtx)->sLogCtx, WELS_LOG_INFO, "WelsUninitEncoderExt(), pthread_join(pThreadHandles%d) return %d..",
iThreadIdx,
res);
(*ppCtx)->pSliceThreading->pThreadHandles[iThreadIdx] = 0;
}
++ iThreadIdx;
while (iThreadIdx < iThreadCount) {
int res = 0;
if ((*ppCtx)->pSliceThreading->pThreadHandles[iThreadIdx]) {
WelsEventSignal (& (*ppCtx)->pSliceThreading->pExitEncodeEvent[iThreadIdx]);
WelsEventSignal (& (*ppCtx)->pSliceThreading->pThreadMasterEvent[iThreadIdx]);
res = WelsThreadJoin ((*ppCtx)->pSliceThreading->pThreadHandles[iThreadIdx]); // waiting thread exit
WelsLog (& (*ppCtx)->sLogCtx, WELS_LOG_INFO, "WelsUninitEncoderExt(), pthread_join(pThreadHandles%d) return %d..",
iThreadIdx,
res);
(*ppCtx)->pSliceThreading->pThreadHandles[iThreadIdx] = 0;
}
++ iThreadIdx;
}
}