diff options
author | Cosmic Linden <cosmic@lindenlab.com> | 2022-05-06 14:46:49 -0700 |
---|---|---|
committer | Cosmic Linden <cosmic@lindenlab.com> | 2022-06-14 11:31:52 -0700 |
commit | 3e60b53d52d09e3f1412a9476743a77e555104d9 (patch) | |
tree | fefd85db87d49d28777f21c7fdb3f972e94998e3 /indra/llcommon/workqueue.h | |
parent | 14ea73033ab64321d4034714ece6ad999093a9a8 (diff) |
SL-16182: Offload audio decoding from the main thread to the general work queue.
The work queue callback binds "this". This is deemed safe due to current dependencies, but see the associated comment in the return callback. There was some trial and error to get a this-binded lambda to compile.
Due to LLVorbisDecodeState writing to disk off-thread, limit audio decodes proportional to general worker thread count. Guess the thread count for now.
Diffstat (limited to 'indra/llcommon/workqueue.h')
-rw-r--r-- | indra/llcommon/workqueue.h | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/indra/llcommon/workqueue.h b/indra/llcommon/workqueue.h index 96574a18b9..70fd65bd0c 100644 --- a/indra/llcommon/workqueue.h +++ b/indra/llcommon/workqueue.h @@ -403,7 +403,7 @@ namespace LL [result = std::forward<CALLABLE>(callable)(), callback = std::move(callback)] () - { callback(std::move(result)); }; + mutable { callback(std::move(result)); }; } }; @@ -449,7 +449,7 @@ namespace LL callable = std::move(callable), callback = std::move(callback)] () - { + mutable { // Use postMaybe() below in case this originating WorkQueue // has been closed or destroyed. Remember, the outer lambda is // now running on a thread servicing the target WorkQueue, and @@ -513,7 +513,7 @@ namespace LL // We dare to bind a reference to Promise because it's // specifically designed for cross-thread communication. [&promise, callable = std::move(callable)]() - { + mutable { try { // call the caller's callable and trigger promise with result @@ -542,7 +542,7 @@ namespace LL time, // &promise is designed for cross-thread access [&promise, callable = std::move(callable)]() - { + mutable { try { callable(); |