Each thread should add itself to the thread pool the first time it runs.
| 170 | |
| 171 | /// Each thread should add itself to the thread pool the first time it runs. |
| 172 | static void addThread(Thread* thread) |
| 173 | { |
| 174 | ThreadManager &manager = *ManagedSingleton< ThreadManager >::instance(); |
| 175 | manager.poolLock.lock(); |
| 176 | Thread *alreadyAdded = getThreadById(thread->getId()); |
| 177 | if(!alreadyAdded) |
| 178 | manager.threadPool.push_back(thread); |
| 179 | manager.poolLock.unlock(); |
| 180 | } |
| 181 | |
| 182 | static void removeThread(Thread* thread) |
| 183 | { |