MCPcopy Create free account
hub / github.com/MayaPosch/NymphCast / threadProc

Method threadProc

src/server/gui/core/resources/TextureDataManager.cpp:153–185  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

151}
152
153void TextureLoader::threadProc()
154{
155 while (!mExit)
156 {
157 std::shared_ptr<TextureData> textureData;
158 {
159 // Wait for an event to say there is something in the queue
160 std::unique_lock<std::mutex> lock(mMutex);
161 mEvent.wait(lock);
162 if (!mTextureDataQ.empty())
163 {
164 textureData = mTextureDataQ.front();
165 mTextureDataQ.pop_front();
166 mTextureDataLookup.erase(mTextureDataLookup.find(textureData.get()));
167 }
168 }
169 // Queue has been released here but we might have a texture to process
170 while (textureData)
171 {
172 textureData->load();
173
174 // See if there is another item in the queue
175 textureData = nullptr;
176 std::unique_lock<std::mutex> lock(mMutex);
177 if (!mTextureDataQ.empty())
178 {
179 textureData = mTextureDataQ.front();
180 mTextureDataQ.pop_front();
181 mTextureDataLookup.erase(mTextureDataLookup.find(textureData.get()));
182 }
183 }
184 }
185}
186
187void TextureLoader::load(std::shared_ptr<TextureData> textureData)
188{

Callers

nothing calls this directly

Calls 5

waitMethod · 0.80
emptyMethod · 0.45
findMethod · 0.45
getMethod · 0.45
loadMethod · 0.45

Tested by

no test coverage detected