Showing the changes to codec/common/src/WelsThreadPool.cpp (1 of 4 files). Show all
Unified · Split
| @@ -38,6 +38,7 @@ · 37 unmodified lines | ||
| 38 | 38 | ************************************************************************************* |
| 39 | 39 | */ |
| 40 | 40 | #include "typedefs.h" |
| 41 | +#include "memory_align.h" | |
| 41 | 42 | #include "WelsThreadPool.h" |
| 42 | 43 | |
| 43 | 44 | namespace WelsCommon { |
| @@ -51,14 +52,9 @@ CWelsThreadPool::CWelsThreadPool (IWelsThreadPoolSink* pSink, int32_t iMaxThread · 7 unmodified lines | ||
| 51 | 52 | m_iMaxThreadNum = 0; |
| 52 | 53 | |
| 53 | 54 | if (NULL == m_cWaitedTasks || NULL == m_cIdleThreads || NULL == m_cBusyThreads) { |
| 54 | − delete m_cWaitedTasks; | |
| 55 | − m_cWaitedTasks = NULL; | |
| 56 | − | |
| 57 | − delete m_cIdleThreads; | |
| 58 | − m_cIdleThreads = NULL; | |
| 59 | − | |
| 60 | − delete m_cBusyThreads; | |
| 61 | − m_cBusyThreads = NULL; | |
| 55 | + WELS_DELETE_OP(m_cWaitedTasks); | |
| 56 | + WELS_DELETE_OP(m_cIdleThreads); | |
| 57 | + WELS_DELETE_OP(m_cBusyThreads); | |
| 62 | 58 | |
| 63 | 59 | return; |
| 64 | 60 | } |
| @@ -66,14 +62,9 @@ CWelsThreadPool::CWelsThreadPool (IWelsThreadPoolSink* pSink, int32_t iMaxThread · 1 unmodified line | ||
| 66 | 62 | if (WELS_THREAD_ERROR_OK != Init (iMaxThreadNum)) { |
| 67 | 63 | Uninit(); |
| 68 | 64 | |
| 69 | − delete m_cWaitedTasks; | |
| 70 | − m_cWaitedTasks = NULL; | |
| 71 | − | |
| 72 | − delete m_cIdleThreads; | |
| 73 | − m_cIdleThreads = NULL; | |
| 74 | − | |
| 75 | − delete m_cBusyThreads; | |
| 76 | − m_cBusyThreads = NULL; | |
| 65 | + WELS_DELETE_OP(m_cWaitedTasks); | |
| 66 | + WELS_DELETE_OP(m_cIdleThreads); | |
| 67 | + WELS_DELETE_OP(m_cBusyThreads); | |
| 77 | 68 | } |
| 78 | 69 | } |
| 79 | 70 | |
| @@ -81,14 +72,9 @@ CWelsThreadPool::CWelsThreadPool (IWelsThreadPoolSink* pSink, int32_t iMaxThread · 1 unmodified line | ||
| 81 | 72 | CWelsThreadPool::~CWelsThreadPool() { |
| 82 | 73 | Uninit(); |
| 83 | 74 | |
| 84 | − delete m_cWaitedTasks; | |
| 85 | − m_cWaitedTasks = NULL; | |
| 86 | − | |
| 87 | − delete m_cIdleThreads; | |
| 88 | − m_cIdleThreads = NULL; | |
| 89 | − | |
| 90 | − delete m_cBusyThreads; | |
| 91 | − m_cBusyThreads = NULL; | |
| 75 | + WELS_DELETE_OP(m_cWaitedTasks); | |
| 76 | + WELS_DELETE_OP(m_cIdleThreads); | |
| 77 | + WELS_DELETE_OP(m_cBusyThreads); | |
| 92 | 78 | } |
| 93 | 79 | |
| 94 | 80 | WELS_THREAD_ERROR_CODE CWelsThreadPool::OnTaskStart (CWelsTaskThread* pThread, IWelsTask* pTask) { |
| @@ -214,7 +200,7 @@ WELS_THREAD_ERROR_CODE CWelsThreadPool::CreateIdleThread() { · 119 unmodified lines | ||
| 214 | 200 | |
| 215 | 201 | void CWelsThreadPool::DestroyThread (CWelsTaskThread* pThread) { |
| 216 | 202 | pThread->Kill(); |
| 217 | − delete pThread; | |
| 203 | + WELS_DELETE_OP(pThread); | |
| 218 | 204 | |
| 219 | 205 | return; |
| 220 | 206 | } |