| 77 | } |
| 78 | |
| 79 | void BlCvTypeWorkThread::Run() |
| 80 | { |
| 81 | // Any failure is instant-abort |
| 82 | while (!mCodeView->mContext->mFailed) |
| 83 | { |
| 84 | BlCvTypeSource* typeSource = NULL; |
| 85 | |
| 86 | mCritSect.Lock(); |
| 87 | if (!mTypeSourceWorkQueue.empty()) |
| 88 | { |
| 89 | typeSource = mTypeSourceWorkQueue.front(); |
| 90 | mTypeSourceWorkQueue.pop_front(); |
| 91 | } |
| 92 | mCritSect.Unlock(); |
| 93 | |
| 94 | if (typeSource == NULL) |
| 95 | { |
| 96 | if (mTypesDone) |
| 97 | break; |
| 98 | |
| 99 | BP_ZONE("Waiting"); |
| 100 | mWorkEvent.WaitFor(); |
| 101 | continue; |
| 102 | } |
| 103 | |
| 104 | BF_ASSERT(!typeSource->mIsDone); |
| 105 | |
| 106 | if (typeSource->mTypeServerLib != NULL) |
| 107 | { |
| 108 | BP_ZONE("Load TypeServerLib"); |
| 109 | if (!typeSource->mTypeServerLib->Load(typeSource->mTypeServerLib->mFileName)) |
| 110 | { |
| 111 | mCodeView->mContext->Fail(StrFormat("Failed to load: %s", typeSource->mTypeServerLib->mFileName.c_str())); |
| 112 | } |
| 113 | } |
| 114 | else |
| 115 | { |
| 116 | BP_ZONE("Load Obj"); |
| 117 | typeSource->mTPI.ScanTypeData(); |
| 118 | typeSource->mTPI.ParseTypeData(); |
| 119 | } |
| 120 | typeSource->mIsDone = true; |
| 121 | //typeSource->mDoneSignal.Set(); |
| 122 | |
| 123 | // The module work thread may be waiting for this type source |
| 124 | mCodeView->mModuleWorkThread.mWorkEvent.Set(); |
| 125 | } |
| 126 | |
| 127 | // Wake up module work thread |
| 128 | mThreadDone = true; |
| 129 | mCodeView->mModuleWorkThread.mWorkEvent.Set(); |
| 130 | } |
| 131 | |
| 132 | void BlCvTypeWorkThread::Add(BlCvTypeSource* typeSource) |
| 133 | { |
nothing calls this directly
no test coverage detected