|
Revision 3417, 3.4 kB
(checked in by patrickh, 8 years ago)
|
Merged the RELENG_0_2 branch into RELENG_1_0. RELENG_0_2 is now considered
a dead branch as we a pushing forward with a 1.0 release instead of a 0.2
beta release. Woo hoo!
|
- Property svn:eol-style set to
native
- Property svn:keywords set to
Author Date Id Revision
|
| Line | |
|---|
| 1 |
|
|---|
| 2 |
|
|---|
| 3 |
|
|---|
| 4 |
|
|---|
| 5 |
|
|---|
| 6 |
|
|---|
| 7 |
|
|---|
| 8 |
|
|---|
| 9 |
|
|---|
| 10 |
|
|---|
| 11 |
|
|---|
| 12 |
|
|---|
| 13 |
|
|---|
| 14 |
|
|---|
| 15 |
|
|---|
| 16 |
|
|---|
| 17 |
|
|---|
| 18 |
|
|---|
| 19 |
|
|---|
| 20 |
|
|---|
| 21 |
|
|---|
| 22 |
|
|---|
| 23 |
|
|---|
| 24 |
|
|---|
| 25 |
|
|---|
| 26 |
|
|---|
| 27 |
|
|---|
| 28 |
|
|---|
| 29 |
|
|---|
| 30 |
|
|---|
| 31 |
|
|---|
| 32 |
|
|---|
| 33 |
|
|---|
| 34 |
#include <vjConfig.h> |
|---|
| 35 |
#include <Threads/vjThreadManager.h> |
|---|
| 36 |
#include <Kernel/vjDebug.h> |
|---|
| 37 |
|
|---|
| 38 |
|
|---|
| 39 |
vjSingletonImp(vjThreadManager); |
|---|
| 40 |
|
|---|
| 41 |
|
|---|
| 42 |
|
|---|
| 43 |
|
|---|
| 44 |
|
|---|
| 45 |
|
|---|
| 46 |
|
|---|
| 47 |
void vjThreadManager::addThread(vjBaseThread* thread) |
|---|
| 48 |
{ |
|---|
| 49 |
vjASSERT(mThreadVectorMutex.test()==1); |
|---|
| 50 |
vjASSERT(thread->getTID() >= 0); |
|---|
| 51 |
|
|---|
| 52 |
|
|---|
| 53 |
while ((int)mThreads.size() <= thread->getTID()) |
|---|
| 54 |
mThreads.push_back(NULL); |
|---|
| 55 |
mThreads[thread->getTID()] = thread; |
|---|
| 56 |
|
|---|
| 57 |
debugDump(); |
|---|
| 58 |
} |
|---|
| 59 |
|
|---|
| 60 |
|
|---|
| 61 |
|
|---|
| 62 |
|
|---|
| 63 |
|
|---|
| 64 |
|
|---|
| 65 |
|
|---|
| 66 |
void vjThreadManager::removeThread(vjBaseThread* thread) |
|---|
| 67 |
{ |
|---|
| 68 |
vjASSERT(mThreadVectorMutex.test()==1); |
|---|
| 69 |
vjASSERT((thread->getTID() >= 0) && (thread->getTID() < (int)mThreads.size())); |
|---|
| 70 |
mThreads[(unsigned int)thread->getTID()] = NULL; |
|---|
| 71 |
} |
|---|
| 72 |
|
|---|
| 73 |
|
|---|
| 74 |
|
|---|
| 75 |
void vjThreadManager::debugDump() |
|---|
| 76 |
{ |
|---|
| 77 |
vjDEBUG(vjDBG_ALL, vjDBG_VERB_LVL) |
|---|
| 78 |
<< "------- Thread Manager DUMP -------\n" << vjDEBUG_FLUSH; |
|---|
| 79 |
vjDEBUG_BEGIN(vjDBG_ALL, vjDBG_STATE_LVL) << "--- Thread List ----\n"; |
|---|
| 80 |
for (unsigned int i=0;i<mThreads.size();i++) |
|---|
| 81 |
{ |
|---|
| 82 |
if (mThreads[i] != NULL) |
|---|
| 83 |
vjDEBUGnl(vjDBG_ALL, vjDBG_STATE_LVL) << i << ": [" |
|---|
| 84 |
<< (void*)mThreads[i] << "] " |
|---|
| 85 |
<< mThreads[i] << std::endl; |
|---|
| 86 |
else |
|---|
| 87 |
vjDEBUGnl(vjDBG_ALL, vjDBG_STATE_LVL) << i << ": [" |
|---|
| 88 |
<< (void*)mThreads[i] |
|---|
| 89 |
<< "] No thread\n"; |
|---|
| 90 |
} |
|---|
| 91 |
|
|---|
| 92 |
vjDEBUG_ENDnl(vjDBG_ALL, vjDBG_STATE_LVL) << "---------------------\n" |
|---|
| 93 |
<< vjDEBUG_FLUSH; |
|---|
| 94 |
} |
|---|
| 95 |
|
|---|
| 96 |
|
|---|
| 97 |
|
|---|
| 98 |
|
|---|
| 99 |
|
|---|
| 100 |
|
|---|