summaryrefslogtreecommitdiff
path: root/indra/newview/llappviewer.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview/llappviewer.cpp')
-rw-r--r--indra/newview/llappviewer.cpp62
1 files changed, 45 insertions, 17 deletions
diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp
index 66c44ef6a6..a63203f3cb 100644
--- a/indra/newview/llappviewer.cpp
+++ b/indra/newview/llappviewer.cpp
@@ -637,6 +637,7 @@ LLAppViewer::LLAppViewer()
mLogoutMarkerFile(),
mReportedCrash(false),
mNumSessions(0),
+ mGeneralThreadPool(nullptr),
mPurgeCache(false),
mPurgeCacheOnExit(false),
mPurgeUserDataOnExit(false),
@@ -1309,10 +1310,13 @@ void LLAppViewer::initMaxHeapSize()
//------------------------------------------------------------------------------------------
//currently SL is built under 32-bit setting, we set its max heap size no more than 1.6 GB.
- //F32 max_heap_size_gb = llmin(1.6f, (F32)gSavedSettings.getF32("MaxHeapSize")) ;
- F32Gigabytes max_heap_size_gb = (F32Gigabytes)gSavedSettings.getF32("MaxHeapSize") ;
+ #ifndef LL_X86_64
+ F32Gigabytes max_heap_size_gb = (F32Gigabytes)gSavedSettings.getF32("MaxHeapSize") ;
+#else
+ F32Gigabytes max_heap_size_gb = (F32Gigabytes)gSavedSettings.getF32("MaxHeapSize64");
+#endif
- LLMemory::initMaxHeapSizeGB(max_heap_size_gb);
+ LLMemory::initMaxHeapSizeGB(max_heap_size_gb);
}
static LLTrace::BlockTimerStatHandle FTM_MESSAGES("System Messages");
@@ -1709,11 +1713,6 @@ void LLAppViewer::flushLFSIO()
bool LLAppViewer::cleanup()
{
- // Since we don't know what functions are going to be queued by
- // onCleanup(), we have to assume they might rely on some of the things
- // we're about to destroy below. Run them first.
- mOnCleanup();
-
LLAtmosphere::cleanupClass();
//ditch LLVOAvatarSelf instance
@@ -2067,6 +2066,10 @@ bool LLAppViewer::cleanup()
sTextureCache->shutdown();
sImageDecodeThread->shutdown();
sPurgeDiskCacheThread->shutdown();
+ if (mGeneralThreadPool)
+ {
+ mGeneralThreadPool->close();
+ }
sTextureFetch->shutDownTextureCacheThread() ;
sTextureFetch->shutDownImageDecodeThread() ;
@@ -2091,6 +2094,8 @@ bool LLAppViewer::cleanup()
mFastTimerLogThread = NULL;
delete sPurgeDiskCacheThread;
sPurgeDiskCacheThread = NULL;
+ delete mGeneralThreadPool;
+ mGeneralThreadPool = NULL;
if (LLFastTimerView::sAnalyzePerformance)
{
@@ -2156,6 +2161,7 @@ bool LLAppViewer::cleanup()
LLEnvironment::deleteSingleton();
LLSelectMgr::deleteSingleton();
LLViewerEventRecorder::deleteSingleton();
+ LLWorld::deleteSingleton();
// It's not at first obvious where, in this long sequence, a generic cleanup
// call OUGHT to go. So let's say this: as we migrate cleanup from
@@ -2176,6 +2182,24 @@ bool LLAppViewer::cleanup()
return true;
}
+void LLAppViewer::initGeneralThread()
+{
+ if (mGeneralThreadPool)
+ {
+ return;
+ }
+
+ LLSD poolSizes{ gSavedSettings.getLLSD("ThreadPoolSizes") };
+ LLSD sizeSpec{ poolSizes["General"] };
+ LLSD::Integer poolSize{ sizeSpec.isInteger() ? sizeSpec.asInteger() : 3 };
+ LL_DEBUGS("ThreadPool") << "Instantiating General pool with "
+ << poolSize << " threads" << LL_ENDL;
+ // We don't want anyone, especially the main thread, to have to block
+ // due to this ThreadPool being full.
+ mGeneralThreadPool = new LL::ThreadPool("General", poolSize, 1024 * 1024);
+ mGeneralThreadPool->start();
+}
+
bool LLAppViewer::initThreads()
{
static const bool enable_threads = true;
@@ -5365,14 +5389,18 @@ void LLAppViewer::disconnectViewer()
}
// save inventory if appropriate
- gInventory.cache(gInventory.getRootFolderID(), gAgent.getID());
- if (gInventory.getLibraryRootFolderID().notNull()
- && gInventory.getLibraryOwnerID().notNull())
- {
- gInventory.cache(
- gInventory.getLibraryRootFolderID(),
- gInventory.getLibraryOwnerID());
- }
+ if (gInventory.isInventoryUsable()
+ && gAgent.getID().notNull()) // Shouldn't be null at this stage
+ {
+ gInventory.cache(gInventory.getRootFolderID(), gAgent.getID());
+ if (gInventory.getLibraryRootFolderID().notNull()
+ && gInventory.getLibraryOwnerID().notNull())
+ {
+ gInventory.cache(
+ gInventory.getLibraryRootFolderID(),
+ gInventory.getLibraryOwnerID());
+ }
+ }
saveNameCache();
if (LLExperienceCache::instanceExists())
@@ -5394,7 +5422,7 @@ void LLAppViewer::disconnectViewer()
// Now we just ask the LLWorld singleton to cleanly shut down.
if(LLWorld::instanceExists())
{
- LLWorld::getInstance()->destroyClass();
+ LLWorld::getInstance()->resetClass();
}
LLVOCache::deleteSingleton();