History

Unify ifdef conditions related to threading code

The two different variants of the threadlib basically are win32 and unix - use _WIN32 to check for this consistently, instead of occasionally using __GNUC__ to enable the unix codepath. (__GNUC__ is also defined on mingw, which still is a windows platform and should use the _WIN32 code.)

Martin Storsjö committed 12 years ago

Commit e0951591 parent c7d98a86 files · +19 −25Browse files

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

Unified · Split

codec/encoder/core/src/slice_multi_threading.cpp+10−12
@@ -41,13 +41,13 @@ · 40 unmodified lines
4141 #if defined(MT_ENABLED)
4242
4343 #include <assert.h>
44−#if defined(__GNUC__) && !defined(_WIN32)
44+#if !defined(_WIN32)
4545 #include <semaphore.h>
4646 #ifndef SEM_NAME_MAX
4747 // length of semaphore name should be system constrained at least on mac 10.7
4848 #define SEM_NAME_MAX 32
4949 #endif//SEM_NAME_MAX
50−#endif//__GNUC__
50+#endif//!_WIN32
5151 #include "slice_multi_threading.h"
5252 #include "mt_defs.h"
5353 #include "nal_encap.h"
@@ -332,13 +332,11 @@ int32_t RequestMtResource (sWelsEncCtx** ppCtx, SWelsSvcCodingParam* pCodingPara · 278 unmodified lines
332332 WELS_VERIFY_RETURN_PROC_IF (1, (NULL == pSmt->pReadySliceCodingEvent), FreeMemorySvc (ppCtx))
333333 pSmt->pFinSliceCodingEvent = (WELS_EVENT*)pMa->WelsMalloc (sizeof (WELS_EVENT) * iThreadNum, "pFinSliceCodingEvent");
334334 WELS_VERIFY_RETURN_PROC_IF (1, (NULL == pSmt->pFinSliceCodingEvent), FreeMemorySvc (ppCtx))
335−#endif//_WIN32
336−
337−#if defined(__GNUC__)
335+#else
338336 pSmt->pUpdateMbListThrdHandles = (WELS_THREAD_HANDLE*)pMa->WelsMalloc (sizeof (WELS_THREAD_HANDLE) * iThreadNum,
339337 "pUpdateMbListThrdHandles");
340338 WELS_VERIFY_RETURN_PROC_IF (1, (NULL == pSmt->pUpdateMbListThrdHandles), FreeMemorySvc (ppCtx))
341−#endif//__GNUC__
339+#endif//!_WIN32
342340 #ifdef _WIN32
343341 pSmt->pUpdateMbListEvent = (WELS_EVENT*)pMa->WelsMalloc (sizeof (WELS_EVENT) * iThreadNum, "pUpdateMbListEvent");
344342 WELS_VERIFY_RETURN_PROC_IF (1, (NULL == pSmt->pUpdateMbListEvent), FreeMemorySvc (ppCtx))
@@ -386,10 +384,10 @@ int32_t RequestMtResource (sWelsEncCtx** ppCtx, SWelsSvcCodingParam* pCodingPara · 41 unmodified lines
386384
387385 iIdx = 0;
388386 while (iIdx < iThreadNum) {
389−#if defined(__GNUC__) && !defined(_WIN32) // for posix threading
387+#if !defined(_WIN32) // for posix threading
390388 char name[SEM_NAME_MAX] = {0};
391389 WELS_THREAD_ERROR_CODE err = 0;
392−#endif//__GNUC__
390+#endif//!_WIN32
393391 pSmt->pThreadPEncCtx[iIdx].pWelsPEncCtx = (void*) (*ppCtx);
394392 pSmt->pThreadPEncCtx[iIdx].iSliceIndex = iIdx;
395393 pSmt->pThreadPEncCtx[iIdx].iThreadIndex = iIdx;
@@ -767,7 +765,7 @@ int32_t WriteSliceBs (sWelsEncCtx* pCtx, uint8_t* pSliceBsBuf, const int32_t iSl · 371 unmodified lines
767765 return iReturn;
768766 }
769767
770−#if defined(__GNUC__) && !defined(_WIN32)
768+#if !defined(_WIN32)
771769 WELS_THREAD_ROUTINE_TYPE UpdateMbListThreadProc (void* arg) {
772770 SSliceThreadPrivateData* pPrivateData = (SSliceThreadPrivateData*)arg;
773771 sWelsEncCtx* pEncPEncCtx = NULL;
@@ -806,7 +804,7 @@ WELS_THREAD_ROUTINE_TYPE UpdateMbListThreadProc (void* arg) { · 32 unmodified lines
806804
807805 WELS_THREAD_ROUTINE_RETURN (uiThrdRet);
808806 }
809−#endif//__GNUC__
807+#endif//!_WIN32
810808
811809 // thread process for coding one pSlice
812810 WELS_THREAD_ROUTINE_TYPE CodingSliceThreadProc (void* arg) {
@@ -1148,10 +1146,10 @@ int32_t CreateSliceThreads (sWelsEncCtx* pCtx) { · 335 unmodified lines
11481146 // We need extra threads for update_mb_list_proc on __GNUC__ like OS (mac/linux)
11491147 // due to WelsMultipleEventsWaitSingleBlocking implememtation can not work well
11501148 // in case waiting pUpdateMbListEvent and pReadySliceCodingEvent events at the same time
1151−#if defined(__GNUC__) && !defined(_WIN32)
1149+#if !defined(_WIN32)
11521150 WelsThreadCreate (&pCtx->pSliceThreading->pUpdateMbListThrdHandles[iIdx], UpdateMbListThreadProc,
11531151 &pCtx->pSliceThreading->pThreadPEncCtx[iIdx], 0);
1154−#endif//__GNUC__
1152+#endif//!_WIN32
11551153
11561154 ++ iIdx;
11571155 }

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