History

Merge WelsThreadDestroy into WelsThreadJoin

Now calling WelsThreadJoin is enough to finish and clean up the thread on all platforms. This unifies the thread cleanup code between windows and unix. Now all of the threading code should use the exact same codepaths between windows and unix.

Martin Storsjö committed 12 years ago

Commit 5b8ee371 parent b4aa9be4 files · +1 −32Browse files

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

Unified · Split

codec/encoder/core/src/encoder_ext.cpp+0−13
@@ -2152,18 +2152,6 @@ void WelsUninitEncoderExt (sWelsEncCtx** ppCtx) { · 2151 unmodified lines
2152 const int32_t iThreadCount = (*ppCtx)->pSvcParam->iCountThreadsNum;2152 const int32_t iThreadCount = (*ppCtx)->pSvcParam->iCountThreadsNum;
2153 int32_t iThreadIdx = 0;2153 int32_t iThreadIdx = 0;
2154 2154
2155#if defined(_WIN32)
2156 if ((*ppCtx)->pSliceThreading->pExitEncodeEvent != NULL) {
2157 do {
2158 if ((*ppCtx)->pSliceThreading->pThreadHandles[iThreadIdx] != NULL) // iThreadIdx is already created successfully
2159 WelsEventSignal (& (*ppCtx)->pSliceThreading->pExitEncodeEvent[iThreadIdx]);
2160 WelsEventSignal (& (*ppCtx)->pSliceThreading->pThreadMasterEvent[iThreadIdx]);
2161 WelsThreadJoin ((*ppCtx)->pSliceThreading->pThreadHandles[iThreadIdx]); // waiting thread exit
2162 ++ iThreadIdx;
2163 } while (iThreadIdx < iThreadCount);
2164
2165 }
2166#else
2167 if ((*ppCtx)->pSliceThreading->pExitEncodeEvent != NULL) {2155 if ((*ppCtx)->pSliceThreading->pExitEncodeEvent != NULL) {
2168 while (iThreadIdx < iThreadCount) {2156 while (iThreadIdx < iThreadCount) {
2169 int res = 0;2157 int res = 0;
@@ -2178,7 +2166,6 @@ void WelsUninitEncoderExt (sWelsEncCtx** ppCtx) { · 8 unmodified lines
2178 ++ iThreadIdx;2166 ++ iThreadIdx;
2179 }2167 }
2180 }2168 }
2181#endif//WIN32
2182 }2169 }
2183#endif//MT_ENABLED2170#endif//MT_ENABLED
2184 2171

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