Skip to content

Commit ad8dc13

Browse files
committed
Reduce thread contention on HTTPStats singleton access via simpleton.
The main thread and http thread had significant contention in asset-fetch heavy scenarios that could result in main thread and http thread stalls when the http thread was accessing the HTTPStats singleton and the master singleton dependency list had to be queried. The HTTP thread is the primary user of HTTPStats with the main thread only calling into it during shut down to query the stats for the session.
1 parent 31774e8 commit ad8dc13

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

indra/llcorehttp/httprequest.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -489,6 +489,7 @@ HttpStatus HttpRequest::createService()
489489
HttpRequestQueue::init();
490490
HttpRequestQueue * rq = HttpRequestQueue::instanceOf();
491491
HttpService::init(rq);
492+
HTTPStats::createInstance();
492493
has_inited = true;
493494
}
494495

@@ -502,6 +503,7 @@ HttpStatus HttpRequest::destroyService()
502503

503504
if (has_inited)
504505
{
506+
HTTPStats::deleteSingleton();
505507
HttpService::term();
506508
HttpRequestQueue::term();
507509
has_inited = false;

indra/llcorehttp/httpstats.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,12 +35,12 @@
3535

3636
namespace LLCore
3737
{
38-
class HTTPStats : public LLSingleton<HTTPStats>
38+
class HTTPStats final : public LLSimpleton<HTTPStats>
3939
{
40-
LLSINGLETON(HTTPStats);
41-
virtual ~HTTPStats();
42-
4340
public:
41+
HTTPStats();
42+
~HTTPStats();
43+
4444
void resetStats();
4545

4646
typedef LLStatsAccumulator StatsAccumulator;

0 commit comments

Comments
 (0)