summaryrefslogtreecommitdiff
path: root/indra/newview/lltexturefetch.h
diff options
context:
space:
mode:
authorMonty Brandenberg <monty@lindenlab.com>2010-12-16 16:42:26 -0800
committerMonty Brandenberg <monty@lindenlab.com>2010-12-16 16:42:26 -0800
commit3c05ebd28635e867f9726062b08cdbf4a7b53b22 (patch)
tree5edce338cba41d8ba7bc24919ab90cad19ab4186 /indra/newview/lltexturefetch.h
parentde8fa40209300a92a595be59073a2f0cb258e15b (diff)
ESC-237 No static init of LLAtomics and move TFRequest out of unnamed namespace.
Linux startup crash appears to be due to static/global C++ init of LLAtomic types. The initializer with explicit value makes some runtime calls and it looks like these assume, at least on Linux, that apr_initialize() has been called. So move the static POST count to a member and provide accessors and increment/decrement. Command queue was built on a pointer to a class in anonymous namespace and that's not quite valid. Made it a nested class (really a nested forward declaration) while keeping the derived classes in anonymous.
Diffstat (limited to 'indra/newview/lltexturefetch.h')
-rw-r--r--indra/newview/lltexturefetch.h16
1 files changed, 14 insertions, 2 deletions
diff --git a/indra/newview/lltexturefetch.h b/indra/newview/lltexturefetch.h
index a8fd3ce244..ad00a7ea36 100644
--- a/indra/newview/lltexturefetch.h
+++ b/indra/newview/lltexturefetch.h
@@ -33,6 +33,7 @@
#include "llworkerthread.h"
#include "llcurl.h"
#include "lltextureinfo.h"
+#include "llapr.h"
class LLViewerTexture;
class LLTextureFetchWorker;
@@ -42,8 +43,6 @@ class LLImageDecodeThread;
class LLHost;
class LLViewerAssetStats;
-namespace { class TFRequest; }
-
// Interface class
class LLTextureFetch : public LLWorkerThread
{
@@ -54,6 +53,8 @@ public:
LLTextureFetch(LLTextureCache* cache, LLImageDecodeThread* imagedecodethread, bool threaded, bool qa_mode);
~LLTextureFetch();
+ class TFRequest;
+
/*virtual*/ S32 update(U32 max_time_ms);
void shutDownTextureCacheThread() ; //called in the main thread after the TextureCacheThread shuts down.
void shutDownImageDecodeThread() ; //called in the main thread after the ImageDecodeThread shuts down.
@@ -100,6 +101,10 @@ public:
bool isQAMode() const { return mQAMode; }
+ // Curl POST counter maintenance
+ inline void incrCurlPOSTCount() { mCurlPOSTRequestCount++; }
+ inline void decrCurlPOSTCount() { mCurlPOSTRequestCount--; }
+
protected:
void addToNetworkQueue(LLTextureFetchWorker* worker);
void removeFromNetworkQueue(LLTextureFetchWorker* worker, bool cancel);
@@ -187,6 +192,13 @@ private:
// If true, modifies some behaviors that help with QA tasks.
const bool mQAMode;
+
+ // Count of POST requests outstanding. We maintain the count
+ // indirectly in the CURL request responder's ctor and dtor and
+ // use it when determining whether or not to sleep the thread. Can't
+ // use the LLCurl module's request counter as it isn't thread compatible.
+ // *NOTE: Don't mix Atomic and static, apr_initialize must be called first.
+ LLAtomic32<S32> mCurlPOSTRequestCount;
public:
// A probabilistically-correct indicator that the current