This avoids using a separate event just for signalling that a thread has finished running.
Showing the changes to codec/encoder/core/src/slice_multi_threading.cpp (1 of 3 files). Show all
Unified · Split
| @@ -362,11 +362,6 @@ int32_t RequestMtResource (sWelsEncCtx** ppCtx, SWelsSvcCodingParam* pCodingPara · 361 unmodified lines | ||
| 362 | 362 | pSmt->pThreadPEncCtx[iIdx].iThreadIndex = iIdx; |
| 363 | 363 | pSmt->pThreadHandles[iIdx] = 0; |
| 364 | 364 | |
| 365 | −#ifdef _WIN32 | |
| 366 | − WelsSnprintf (name, SEM_NAME_MAX, "fs%d%s", iIdx, pSmt->eventNamespace); | |
| 367 | − err = WelsEventOpen (&pSmt->pFinSliceCodingEvent[iIdx], name); | |
| 368 | − MT_TRACE_LOG ((*ppCtx), WELS_LOG_INFO, "[MT] Open pFinSliceCodingEvent%d named(%s) ret%d err%d\n", iIdx, name, err, errno); | |
| 369 | −#endif//_WIN32 | |
| 370 | 365 | WelsSnprintf (name, SEM_NAME_MAX, "ee%d%s", iIdx, pSmt->eventNamespace); |
| 371 | 366 | err = WelsEventOpen (&pSmt->pExitEncodeEvent[iIdx], name); |
| 372 | 367 | MT_TRACE_LOG ((*ppCtx), WELS_LOG_INFO, "[MT] Open pExitEncodeEvent%d named(%s) ret%d err%d\n", iIdx, name, err, errno); |
| @@ -460,8 +455,6 @@ void ReleaseMtResource (sWelsEncCtx** ppCtx) { · 87 unmodified lines | ||
| 460 | 455 | if (pSmt->pThreadHandles != NULL && pSmt->pThreadHandles[iIdx] != NULL) |
| 461 | 456 | WelsThreadDestroy (&pSmt->pThreadHandles[iIdx]); |
| 462 | 457 | |
| 463 | − WelsSnprintf (ename, SEM_NAME_MAX, "fs%d%s", iIdx, pSmt->eventNamespace); | |
| 464 | − WelsEventClose (&pSmt->pFinSliceCodingEvent[iIdx], ename); | |
| 465 | 458 | #endif//_WIN32 |
| 466 | 459 | WelsSnprintf (ename, SEM_NAME_MAX, "ee%d%s", iIdx, pSmt->eventNamespace); |
| 467 | 460 | WelsEventClose (&pSmt->pExitEncodeEvent[iIdx], ename); |
| @@ -957,10 +950,6 @@ WELS_THREAD_ROUTINE_TYPE CodingSliceThreadProc (void* arg) { · 489 unmodified lines | ||
| 957 | 950 | } |
| 958 | 951 | } while (1); |
| 959 | 952 | |
| 960 | −#ifdef _WIN32 | |
| 961 | − WelsEventSignal (&pEncPEncCtx->pSliceThreading->pFinSliceCodingEvent[iEventIdx]); // notify to mother encoding threading | |
| 962 | −#endif//WIN32 | |
| 963 | − | |
| 964 | 953 | //sync multi-threading error |
| 965 | 954 | WelsMutexLock (&pEncPEncCtx->mutexEncoderError); |
| 966 | 955 | if (uiThrdRet) pEncPEncCtx->iEncoderError |= uiThrdRet; |