MCPcopy Create free account
hub / github.com/GarageGames/Torque3D / getThreadById

Method getThreadById

Engine/source/platform/threads/thread.h:202–221  ·  view source on GitHub ↗

Searches the pool of known threads for a thread whose id is equivalent to the given threadid. Compares thread ids with ThreadManager::compare().

Source from the content-addressed store, hash-verified

200 /// Searches the pool of known threads for a thread whose id is equivalent to
201 /// the given threadid. Compares thread ids with ThreadManager::compare().
202 static Thread* getThreadById(U32 threadid)
203 {
204 AssertFatal(threadid != 0, "ThreadManager::getThreadById() Searching for a bad thread id.");
205 Thread* ret = NULL;
206
207 ThreadManager &manager = *ManagedSingleton< ThreadManager >::instance();
208 manager.poolLock.lock();
209 Vector<Thread*> &pool = manager.threadPool;
210 for( S32 i = pool.size() - 1; i >= 0; i--)
211 {
212 Thread* p = pool[i];
213 if(compare(p->getId(), threadid))
214 {
215 ret = p;
216 break;
217 }
218 }
219 manager.poolLock.unlock();
220 return ret;
221 }
222
223 static Thread* getCurrentThread()
224 {

Callers

nothing calls this directly

Calls 5

compareFunction · 0.85
lockMethod · 0.45
sizeMethod · 0.45
getIdMethod · 0.45
unlockMethod · 0.45

Tested by

no test coverage detected