Showing the changes to codec/common/src/WelsThreadPool.cpp (1 of 2 files). Show all
Unified · Split
| @@ -50,7 +50,19 @@ CWelsThreadPool::CWelsThreadPool (IWelsThreadPoolSink* pSink, int32_t iMaxThread · 49 unmodified lines | ||
| 50 | 50 | m_cBusyThreads = new CWelsList<CWelsTaskThread>(); |
| 51 | 51 | m_iMaxThreadNum = 0; |
| 52 | 52 | |
| 53 | − Init (iMaxThreadNum); | |
| 53 | + if (NULL == m_cWaitedTasks || NULL == m_cIdleThreads || NULL == m_cBusyThreads) { | |
| 54 | + delete m_cWaitedTasks; | |
| 55 | + delete m_cIdleThreads; | |
| 56 | + delete m_cBusyThreads; | |
| 57 | + return; | |
| 58 | + } | |
| 59 | + | |
| 60 | + if (WELS_THREAD_ERROR_OK != Init (iMaxThreadNum)) { | |
| 61 | + Uninit(); | |
| 62 | + delete m_cWaitedTasks; | |
| 63 | + delete m_cIdleThreads; | |
| 64 | + delete m_cBusyThreads; | |
| 65 | + } | |
| 54 | 66 | } |
| 55 | 67 | |
| 56 | 68 | |
| @@ -175,7 +187,9 @@ WELS_THREAD_ERROR_CODE CWelsThreadPool::CreateIdleThread() { · 118 unmodified lines | ||
| 175 | 187 | return WELS_THREAD_ERROR_GENERAL; |
| 176 | 188 | } |
| 177 | 189 | |
| 178 | − pThread->Start(); | |
| 190 | + if (WELS_THREAD_ERROR_OK != pThread->Start()) { | |
| 191 | + return WELS_THREAD_ERROR_GENERAL; | |
| 192 | + } | |
| 179 | 193 | AddThreadToIdleQueue (pThread); |
| 180 | 194 | |
| 181 | 195 | return WELS_THREAD_ERROR_OK; |