MCPcopy Create free account
hub / github.com/cuberite/cuberite / thrProcessQueueItem

Method thrProcessQueueItem

Tools/BiomeVisualiser/BiomeCache.cpp:259–296  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

257
258
259void cBiomeCache::thrProcessQueueItem(void)
260{
261 if (m_Source == NULL)
262 {
263 return;
264 }
265
266 cItem * Item = NULL;
267 {
268 cCSLock Lock(m_CS);
269 if (m_Queue.empty())
270 {
271 cCSUnlock Unlock(Lock);
272 m_evtQueued.Wait();
273 }
274 if (m_IsTerminatingThreads || m_Queue.empty())
275 {
276 // We've been woken up only to die / spurious wakeup
277 return;
278 }
279 Item = m_Queue.back();
280 m_Queue.pop_back();
281 }
282
283 // Process the item:
284 Item->m_IsValid = (m_Source->GetBiome(Item->m_ChunkX, Item->m_ChunkZ, Item->m_Biomes) == baNow);
285
286 // Store result:
287 cCSLock Lock(m_CS);
288 int x = Item->m_ChunkX - m_BaseX;
289 int z = Item->m_ChunkZ - m_BaseZ;
290 if ((x < 0) || (x >= m_Width) || (z < 0) || (z >= m_Height))
291 {
292 // The cache rectangle has changed under our fingers, drop this chunk
293 return;
294 }
295 m_Available[x + m_Width * z] = Item;
296}
297
298
299

Callers 1

ExecuteMethod · 0.80

Calls 3

emptyMethod · 0.80
WaitMethod · 0.45
GetBiomeMethod · 0.45

Tested by

no test coverage detected