diff options
author | Nat Goodspeed <nat@lindenlab.com> | 2021-11-05 12:33:31 -0400 |
---|---|---|
committer | Nat Goodspeed <nat@lindenlab.com> | 2021-11-05 12:33:31 -0400 |
commit | ff5496239bffadaca111b1e4380a01447f85843a (patch) | |
tree | 990a2b72d8eea23f6ef7539079c515aab30625ac /indra/llrender/llimagegl.h | |
parent | 834e7ca088b5f417235327cd290b42459c733594 (diff) |
SL-16202: Use WorkQueue::postTo() for texture create/post handshake.
That is, when LLViewerFetchedTexture::scheduleCreateTexture() wants to call
createTexture() on the LLImageGLThread, but postCreateTexture() on the main
thread, use the "mainloop" WorkQueue to set up the handshake.
Give ThreadPool a public virtual run() method so a subclass can override with
desired behavior. This necessitates a virtual destructor. Add accessors for
embedded WorkQueue (for post calls), ThreadPool name and width (in threads).
Allow LLSimpleton::createInstance() to forward arguments to the subject
constructor.
Make LLImageGLThread an LLSimpleton - that abstraction didn't yet exist at the
time LLImageGLThread was coded. Also derive from ThreadPool rather than
LLThread. Make it a single-thread "pool" with a very large queue capacity.
Diffstat (limited to 'indra/llrender/llimagegl.h')
-rw-r--r-- | indra/llrender/llimagegl.h | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/indra/llrender/llimagegl.h b/indra/llrender/llimagegl.h index b9de481aae..27496def1d 100644 --- a/indra/llrender/llimagegl.h +++ b/indra/llrender/llimagegl.h @@ -37,6 +37,7 @@ #include "llunits.h" #include "llthreadsafequeue.h" #include "llrender.h" +#include "threadpool.h" #include "workqueue.h" class LLTextureAtlas ; @@ -307,7 +308,7 @@ public: }; -class LLImageGLThread : public LLThread +class LLImageGLThread : public LLSimpleton<LLImageGLThread>, LL::ThreadPool { public: LLImageGLThread(LLWindow* window); @@ -316,19 +317,15 @@ public: template <typename CALLABLE> bool post(CALLABLE&& func) { - return mFunctionQueue.postIfOpen(std::forward<CALLABLE>(func)); + return getQueue().postIfOpen(std::forward<CALLABLE>(func)); } void run() override; - // Work Queue for background thread - LL::WorkQueue mFunctionQueue; - +private: LLWindow* mWindow; void* mContext; LLAtomicBool mFinished; - - static LLImageGLThread* sInstance; }; |