Use pExitEncodeEvent instead of thread cancellation on unix as well
This works now that we've got a suitably working implementation of WelsMultipleEventsWaitSingleBlocking.
This commit is contained in:
parent
38a3fada24
commit
baaa38737e
@ -2165,18 +2165,19 @@ void WelsUninitEncoderExt (sWelsEncCtx** ppCtx) {
|
||||
|
||||
}
|
||||
#else
|
||||
while (iThreadIdx < iThreadCount) {
|
||||
int res = 0;
|
||||
if ((*ppCtx)->pSliceThreading->pThreadHandles[iThreadIdx]) {
|
||||
res = WelsThreadCancel ((*ppCtx)->pSliceThreading->pThreadHandles[iThreadIdx]);
|
||||
WelsLog (*ppCtx, WELS_LOG_INFO, "WelsUninitEncoderExt(), WelsThreadCancel(pThreadHandles%d) return %d..\n", iThreadIdx,
|
||||
res);
|
||||
res = WelsThreadJoin ((*ppCtx)->pSliceThreading->pThreadHandles[iThreadIdx]); // waiting thread exit
|
||||
WelsLog (*ppCtx, WELS_LOG_INFO, "WelsUninitEncoderExt(), pthread_join(pThreadHandles%d) return %d..\n", iThreadIdx,
|
||||
res);
|
||||
(*ppCtx)->pSliceThreading->pThreadHandles[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, WELS_LOG_INFO, "WelsUninitEncoderExt(), pthread_join(pThreadHandles%d) return %d..\n", iThreadIdx,
|
||||
res);
|
||||
(*ppCtx)->pSliceThreading->pThreadHandles[iThreadIdx] = 0;
|
||||
}
|
||||
++ iThreadIdx;
|
||||
}
|
||||
++ iThreadIdx;
|
||||
}
|
||||
#endif//WIN32
|
||||
}
|
||||
|
@ -705,8 +705,6 @@ WELS_THREAD_ROUTINE_TYPE CodingSliceThreadProc (void* arg) {
|
||||
if (NULL == pPrivateData)
|
||||
WELS_THREAD_ROUTINE_RETURN (1);
|
||||
|
||||
WelsSetThreadCancelable();
|
||||
|
||||
pEncPEncCtx = (sWelsEncCtx*)pPrivateData->pWelsPEncCtx;
|
||||
|
||||
iThreadIdx = pPrivateData->iThreadIndex;
|
||||
|
Loading…
x
Reference in New Issue
Block a user