1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-06-27 16:36:03 +00:00

Add questionable workaround for env lock contention

This commit is contained in:
sfan5 2024-09-15 23:06:03 +02:00
parent 5f308deb50
commit c1ea49940b
5 changed files with 65 additions and 5 deletions

View file

@ -316,6 +316,12 @@ bool EmergeManager::enqueueBlockEmergeEx(
}
size_t EmergeManager::getQueueSize()
{
MutexAutoLock queuelock(m_queue_mutex);
return m_blocks_enqueued.size();
}
bool EmergeManager::isBlockInQueue(v3s16 pos)
{
MutexAutoLock queuelock(m_queue_mutex);
@ -540,7 +546,9 @@ bool EmergeThread::popBlockEmerge(v3s16 *pos, BlockEmergeData *bedata)
EmergeAction EmergeThread::getBlockOrStartGen(const v3s16 pos, bool allow_gen,
const std::string *from_db, MapBlock **block, BlockMakeData *bmdata)
{
//TimeTaker tt("", nullptr, PRECISION_MICRO);
Server::EnvAutoLock envlock(m_server);
//g_profiler->avg("EmergeThread: lock wait time [us]", tt.stop());
auto block_ok = [] (MapBlock *b) {
return b && b->isGenerated();