diff options
Diffstat (limited to 'indra')
| -rw-r--r-- | indra/newview/app_settings/settings.xml | 11 | ||||
| -rw-r--r-- | indra/newview/llappviewer.cpp | 18 | 
2 files changed, 29 insertions, 0 deletions
diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index 05c3fc3bfe..802453d508 100644 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -3858,6 +3858,17 @@          <key>Value</key>          <integer>1</integer>      </map> +    <key>MainWorkTime</key> +    <map> +        <key>Comment</key> +        <string>Max time per frame devoted to mainloop work queue (in milliseconds)</string> +        <key>Persist</key> +        <integer>1</integer> +        <key>Type</key> +        <string>F32</string> +        <key>Value</key> +        <real>0.1</real> +    </map>      <key>QueueInventoryFetchTimeout</key>      <map>          <key>Comment</key> diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp index 722a6caa65..7c932a3959 100644 --- a/indra/newview/llappviewer.cpp +++ b/indra/newview/llappviewer.cpp @@ -233,6 +233,8 @@  #include "llavatariconctrl.h"  #include "llgroupiconctrl.h"  #include "llviewerassetstats.h" +#include "workqueue.h" +using namespace LL;  // Include for security api initialization  #include "llsecapi.h" @@ -366,6 +368,8 @@ BOOL gLogoutInProgress = FALSE;  BOOL gSimulateMemLeak = FALSE; +WorkQueue gMainloopWork("mainloop"); +  ////////////////////////////////////////////////////////////  // Internal globals... that should be removed.  static std::string gArgs; @@ -5210,6 +5214,20 @@ void LLAppViewer::idle()  	// Execute deferred tasks.  	LLDeferredTaskList::instance().run(); +	// Service the WorkQueue we use for replies from worker threads. +	// Use function statics for the timeslice setting so we only have to fetch +	// and convert MainWorkTime once. +	static F32 MainWorkTimeRaw = gSavedSettings.getF32("MainWorkTime"); +	static F32Milliseconds MainWorkTimeMs(MainWorkTimeRaw); +	// MainWorkTime is specified in fractional milliseconds, but std::chrono +	// uses integer representations. What if we want less than a microsecond? +	// Use nanoseconds. We're very sure we will never need to specify a +	// MainWorkTime that would be larger than we could express in +	// std::chrono::nanoseconds. +	static std::chrono::nanoseconds MainWorkTimeNanoSec{ +		std::chrono::nanoseconds::rep(MainWorkTimeMs.value() * 1000000)}; +	gMainloopWork.runFor(MainWorkTimeNanoSec); +  	// Handle shutdown process, for example,  	// wait for floaters to close, send quit message,  	// forcibly quit if it has taken too long  | 
