diff options
author | Andrey Kleshchev <andreykproductengine@lindenlab.com> | 2025-04-09 19:54:50 +0300 |
---|---|---|
committer | Andrey Kleshchev <117672381+akleshchev@users.noreply.github.com> | 2025-04-11 12:36:48 +0300 |
commit | 1c90421b8873a2228a845ea2f7f4a80758500aa6 (patch) | |
tree | 5d6eded101e82e3451c2cee811cf3ca7c6e794f5 | |
parent | 1bb8fb2795920b57a5934ffa394d78a6c5733ce8 (diff) |
#3596 Faster mesh thread shutdown
-rw-r--r-- | indra/llcommon/lluuid.cpp | 15 | ||||
-rw-r--r-- | indra/llcommon/lluuid.h | 2 | ||||
-rw-r--r-- | indra/newview/llinventorymodel.cpp | 2 | ||||
-rw-r--r-- | indra/newview/llmeshrepository.cpp | 29 | ||||
-rw-r--r-- | indra/newview/llmeshrepository.h | 3 |
5 files changed, 31 insertions, 20 deletions
diff --git a/indra/llcommon/lluuid.cpp b/indra/llcommon/lluuid.cpp index b9bd27aa17..4aae90626e 100644 --- a/indra/llcommon/lluuid.cpp +++ b/indra/llcommon/lluuid.cpp @@ -174,14 +174,6 @@ void LLUUID::toString(std::string& out) const (U8)(mData[15])); } -// *TODO: deprecate -void LLUUID::toString(char* out) const -{ - std::string buffer; - toString(buffer); - strcpy(out, buffer.c_str()); /* Flawfinder: ignore */ -} - void LLUUID::toCompressedString(std::string& out) const { char bytes[UUID_BYTES + 1]; @@ -190,13 +182,6 @@ void LLUUID::toCompressedString(std::string& out) const out.assign(bytes, UUID_BYTES); } -// *TODO: deprecate -void LLUUID::toCompressedString(char* out) const -{ - memcpy(out, mData, UUID_BYTES); /* Flawfinder: ignore */ - out[UUID_BYTES] = '\0'; -} - std::string LLUUID::getString() const { return asString(); diff --git a/indra/llcommon/lluuid.h b/indra/llcommon/lluuid.h index bd4edc7993..ca1cf03c4d 100644 --- a/indra/llcommon/lluuid.h +++ b/indra/llcommon/lluuid.h @@ -103,9 +103,7 @@ public: friend LL_COMMON_API std::ostream& operator<<(std::ostream& s, const LLUUID &uuid); friend LL_COMMON_API std::istream& operator>>(std::istream& s, LLUUID &uuid); - void toString(char *out) const; // Does not allocate memory, needs 36 characters (including \0) void toString(std::string& out) const; - void toCompressedString(char *out) const; // Does not allocate memory, needs 17 characters (including \0) void toCompressedString(std::string& out) const; std::string asString() const; diff --git a/indra/newview/llinventorymodel.cpp b/indra/newview/llinventorymodel.cpp index 6f4d2db12e..0a2d938bd0 100644 --- a/indra/newview/llinventorymodel.cpp +++ b/indra/newview/llinventorymodel.cpp @@ -3526,7 +3526,7 @@ bool LLInventoryModel::saveToFile(const std::string& filename, fileXML.close(); - LL_INFOS(LOG_INV) << "Inventory saved: " << cat_count << " categories, " << it_count << " items." << LL_ENDL; + LL_INFOS(LOG_INV) << "Inventory saved: " << (S32)cat_count << " categories, " << (S32)it_count << " items." << LL_ENDL; } catch (...) { diff --git a/indra/newview/llmeshrepository.cpp b/indra/newview/llmeshrepository.cpp index a8c6f69425..48c80842b9 100644 --- a/indra/newview/llmeshrepository.cpp +++ b/indra/newview/llmeshrepository.cpp @@ -1210,6 +1210,12 @@ void LLMeshRepoThread::run() LL_WARNS(LOG_MESH) << "Convex decomposition unable to be quit." << LL_ENDL; } } +void LLMeshRepoThread::cleanup() +{ + mShuttingDown = true; + mSignal->broadcast(); + mMeshThreadPool->close(); +} // Mutex: LLMeshRepoThread::mMutex must be held on entry void LLMeshRepoThread::loadMeshSkinInfo(const LLUUID& mesh_id) @@ -1493,6 +1499,11 @@ bool LLMeshRepoThread::fetchMeshSkinInfo(const LLUUID& mesh_id) [mesh_id, buffer, size] () { + if (gMeshRepo.mThread->isShuttingDown()) + { + delete[] buffer; + return; + } if (!gMeshRepo.mThread->skinInfoReceived(mesh_id, buffer, size)) { // either header is faulty or something else overwrote the cache @@ -1993,6 +2004,11 @@ bool LLMeshRepoThread::fetchMeshLOD(const LLVolumeParams& mesh_params, S32 lod) [params, mesh_id, lod, buffer, size] () { + if (gMeshRepo.mThread->isShuttingDown()) + { + delete[] buffer; + return; + } if (gMeshRepo.mThread->lodReceived(params, lod, buffer, size) == MESH_OK) { LL_DEBUGS(LOG_MESH) << "Mesh/Cache: Mesh body for ID " << mesh_id << " - was retrieved from the cache." << LL_ENDL; @@ -3792,6 +3808,11 @@ void LLMeshLODHandler::processData(LLCore::BufferArray * /* body */, S32 /* body [shrd_handler, data, data_size] () { + if (gMeshRepo.mThread->isShuttingDown()) + { + delete[] data; + return; + } LLMeshLODHandler* handler = (LLMeshLODHandler * )shrd_handler.get(); handler->processLod(data, data_size); delete[] data; @@ -3905,6 +3926,11 @@ void LLMeshSkinInfoHandler::processData(LLCore::BufferArray * /* body */, S32 /* [shrd_handler, data, data_size] () { + if (gMeshRepo.mThread->isShuttingDown()) + { + delete[] data; + return; + } LLMeshSkinInfoHandler* handler = (LLMeshSkinInfoHandler*)shrd_handler.get(); handler->processSkin(data, data_size); delete[] data; @@ -4127,8 +4153,7 @@ void LLMeshRepository::shutdown() mUploads[i]->discard() ; //discard the uploading requests. } - mThread->mSignal->broadcast(); - mThread->mMeshThreadPool->close(); + mThread->cleanup(); while (!mThread->isStopped()) { diff --git a/indra/newview/llmeshrepository.h b/indra/newview/llmeshrepository.h index 0d9da32e27..b9acb3573f 100644 --- a/indra/newview/llmeshrepository.h +++ b/indra/newview/llmeshrepository.h @@ -515,6 +515,8 @@ public: ~LLMeshRepoThread(); virtual void run(); + void cleanup(); + bool isShuttingDown() { return mShuttingDown; } void lockAndLoadMeshLOD(const LLVolumeParams& mesh_params, S32 lod); void loadMeshLOD(const LLVolumeParams& mesh_params, S32 lod); @@ -583,6 +585,7 @@ private: U8* getDiskCacheBuffer(S32 size); S32 mDiskCacheBufferSize = 0; U8* mDiskCacheBuffer = nullptr; + bool mShuttingDown = false; }; |