History

Use pExitEncodeEvent instead of thread cancellation on unix as well

This works now that we've got a suitably working implementation of WelsMultipleEventsWaitSingleBlocking.

Martin Storsjö committed 12 years ago

Commit baaa3871 parent 38a3fad2 files · +12 −13Browse files

Showing the changes to codec/encoder/core/src/encoder_ext.cpp (1 of 2 files). Show all

Unified · Split

codec/encoder/core/src/encoder_ext.cpp+12−11
@@ -2165,18 +2165,19 @@ void WelsUninitEncoderExt (sWelsEncCtx** ppCtx) { · 2164 unmodified lines
21652165
21662166 }
21672167 #else
2168− while (iThreadIdx < iThreadCount) {
2169− int res = 0;
2170− if ((*ppCtx)->pSliceThreading->pThreadHandles[iThreadIdx]) {
2171− res = WelsThreadCancel ((*ppCtx)->pSliceThreading->pThreadHandles[iThreadIdx]);
2172− WelsLog (*ppCtx, WELS_LOG_INFO, "WelsUninitEncoderExt(), WelsThreadCancel(pThreadHandles%d) return %d..\n", iThreadIdx,
2173− res);
2174− res = WelsThreadJoin ((*ppCtx)->pSliceThreading->pThreadHandles[iThreadIdx]); // waiting thread exit
2175− WelsLog (*ppCtx, WELS_LOG_INFO, "WelsUninitEncoderExt(), pthread_join(pThreadHandles%d) return %d..\n", iThreadIdx,
2176− res);
2177− (*ppCtx)->pSliceThreading->pThreadHandles[iThreadIdx] = 0;
2168+ if ((*ppCtx)->pSliceThreading->pExitEncodeEvent != NULL) {
2169+ while (iThreadIdx < iThreadCount) {
2170+ int res = 0;
2171+ if ((*ppCtx)->pSliceThreading->pThreadHandles[iThreadIdx]) {
2172+ WelsEventSignal (& (*ppCtx)->pSliceThreading->pExitEncodeEvent[iThreadIdx]);
2173+ WelsEventSignal (& (*ppCtx)->pSliceThreading->pThreadMasterEvent[iThreadIdx]);
2174+ res = WelsThreadJoin ((*ppCtx)->pSliceThreading->pThreadHandles[iThreadIdx]); // waiting thread exit
2175+ WelsLog (*ppCtx, WELS_LOG_INFO, "WelsUninitEncoderExt(), pthread_join(pThreadHandles%d) return %d..\n", iThreadIdx,
2176+ res);
2177+ (*ppCtx)->pSliceThreading->pThreadHandles[iThreadIdx] = 0;
2178+ }
2179+ ++ iThreadIdx;
21782180 }
2179− ++ iThreadIdx;
21802181 }
21812182 #endif//WIN32
21822183 }

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t