diff options
author | Brad Linden <brad@lindenlab.com> | 2024-06-10 16:22:12 -0700 |
---|---|---|
committer | Brad Linden <brad@lindenlab.com> | 2024-06-10 16:22:12 -0700 |
commit | 7c42711ca3a4e67b95473aa5129dce5ff19bea15 (patch) | |
tree | 593c0bedf07bffc79ec4640b157839edf61260f5 /indra/llcommon/llthread.h | |
parent | e0e6e7fd747121442370fc811c84aa34ed612f64 (diff) | |
parent | 9f6b8484dfb7dfa981d8a8ac3693d3f68e32bc12 (diff) |
Merge remote-tracking branch 'origin/DRTVWR-600-maint-A' into project/gltf_development
Diffstat (limited to 'indra/llcommon/llthread.h')
-rw-r--r-- | indra/llcommon/llthread.h | 30 |
1 files changed, 15 insertions, 15 deletions
diff --git a/indra/llcommon/llthread.h b/indra/llcommon/llthread.h index cf2ae00cd7..4194e0014d 100644 --- a/indra/llcommon/llthread.h +++ b/indra/llcommon/llthread.h @@ -1,25 +1,25 @@ -/** +/** * @file llthread.h * @brief Base classes for thread, mutex and condition handling. * * $LicenseInfo:firstyear=2004&license=viewerlgpl$ * Second Life Viewer Source Code * Copyright (C) 2010-2013, Linden Research, Inc. - * + * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; * version 2.1 of the License only. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. - * + * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * + * * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA * $/LicenseInfo$ */ @@ -55,10 +55,10 @@ public: LLThread(const std::string& name, apr_pool_t *poolp = NULL); virtual ~LLThread(); // Warning! You almost NEVER want to destroy a thread unless it's in the STOPPED state. virtual void shutdown(); // stops the thread - + bool isQuitting() const { return (QUITTING == mStatus); } bool isStopped() const { return (STOPPED == mStatus) || (CRASHED == mStatus); } - bool isCrashed() const { return (CRASHED == mStatus); } + bool isCrashed() const { return (CRASHED == mStatus); } static id_t currentID(); // Return ID of current thread static void yield(); // Static because it can be called by the main thread, which doesn't have an LLThread data structure. @@ -90,11 +90,11 @@ public: // internal state used by LLMutex. You must call this once early // in the running thread to prevent collisions with the main thread. static void registerThreadID(); - + private: bool mPaused; std::thread::native_handle_type mNativeHandle; // for termination in case of issues - + // static function passed to APR thread creation routine void threadRun(); @@ -111,21 +111,21 @@ protected: //a local apr_pool for APRFile operations in this thread. If it exists, LLAPRFile::sAPRFilePoolp should not be used. //Note: this pool is used by APRFile ONLY, do NOT use it for any other purposes. // otherwise it will cause severe memory leaking!!! --bao - LLVolatileAPRPool *mLocalAPRFilePoolp ; + LLVolatileAPRPool *mLocalAPRFilePoolp ; void setQuitting(); - + // virtual function overridden by subclass -- this will be called when the thread runs - virtual void run(void) = 0; - + virtual void run(void) = 0; + // virtual predicate function -- returns true if the thread should wake up, false if it should sleep. virtual bool runCondition(void); // Lock/Unlock Run Condition -- use around modification of any variable used in runCondition() void lockData(); void unlockData(); - - // This is the predicate that decides whether the thread should sleep. + + // This is the predicate that decides whether the thread should sleep. // It should only be called with mDataLock locked, since the virtual runCondition() function may need to access // data structures that are thread-unsafe. bool shouldSleep(void) { return (mStatus == RUNNING) && (isPaused() || (!runCondition())); } |