diff options
Diffstat (limited to 'indra/llcommon')
-rw-r--r-- | indra/llcommon/CMakeLists.txt | 2 | ||||
-rw-r--r-- | indra/llcommon/llapr.cpp | 161 | ||||
-rw-r--r-- | indra/llcommon/llapr.h | 34 | ||||
-rw-r--r-- | indra/llcommon/llassettype.cpp | 154 | ||||
-rw-r--r-- | indra/llcommon/llassettype.h | 62 | ||||
-rw-r--r-- | indra/llcommon/llfoldertype.cpp | 165 | ||||
-rw-r--r-- | indra/llcommon/llfoldertype.h | 123 | ||||
-rw-r--r-- | indra/llcommon/llqueuedthread.cpp | 70 | ||||
-rw-r--r-- | indra/llcommon/llqueuedthread.h | 4 | ||||
-rw-r--r-- | indra/llcommon/llthread.h | 2 | ||||
-rw-r--r-- | indra/llcommon/llworkerthread.cpp | 1 | ||||
-rw-r--r-- | indra/llcommon/llworkerthread.h | 6 |
12 files changed, 521 insertions, 263 deletions
diff --git a/indra/llcommon/CMakeLists.txt b/indra/llcommon/CMakeLists.txt index e7aaf3c984..f785698612 100644 --- a/indra/llcommon/CMakeLists.txt +++ b/indra/llcommon/CMakeLists.txt @@ -50,6 +50,7 @@ set(llcommon_SOURCE_FILES llfile.cpp llfindlocale.cpp llfixedbuffer.cpp + llfoldertype.cpp llformat.cpp llframetimer.cpp llheartbeat.cpp @@ -150,6 +151,7 @@ set(llcommon_HEADER_FILES llfile.h llfindlocale.h llfixedbuffer.h + llfoldertype.h llformat.h llframetimer.h llhash.h diff --git a/indra/llcommon/llapr.cpp b/indra/llcommon/llapr.cpp index 669afc5330..ed70b1d9f2 100644 --- a/indra/llcommon/llapr.cpp +++ b/indra/llcommon/llapr.cpp @@ -57,7 +57,7 @@ void ll_init_apr() if(!LLAPRFile::sAPRFilePoolp) { - LLAPRFile::sAPRFilePoolp = new LLVolatileAPRPool() ; + LLAPRFile::sAPRFilePoolp = new LLVolatileAPRPool(FALSE) ; } } @@ -99,13 +99,12 @@ void ll_cleanup_apr() // //LLAPRPool // -LLAPRPool::LLAPRPool(apr_pool_t *parent, apr_size_t size, BOOL releasePoolFlag) -{ - mParent = parent ; - mReleasePoolFlag = releasePoolFlag ; - mMaxSize = size ; - mPool = NULL ; - +LLAPRPool::LLAPRPool(apr_pool_t *parent, apr_size_t size, BOOL releasePoolFlag) + : mParent(parent), + mReleasePoolFlag(releasePoolFlag), + mMaxSize(size), + mPool(NULL) +{ createAPRPool() ; } @@ -148,31 +147,65 @@ void LLAPRPool::releaseAPRPool() } } +//virtual apr_pool_t* LLAPRPool::getAPRPool() +{ + return mPool ; +} + +LLVolatileAPRPool::LLVolatileAPRPool(BOOL is_local, apr_pool_t *parent, apr_size_t size, BOOL releasePoolFlag) + : LLAPRPool(parent, size, releasePoolFlag), + mNumActiveRef(0), + mNumTotalRef(0), + mMutexPool(NULL), + mMutexp(NULL) { - if(!mPool) + //create mutex + if(!is_local) //not a local apr_pool, that is: shared by multiple threads. { - createAPRPool() ; + apr_pool_create(&mMutexPool, NULL); // Create a pool for mutex + apr_thread_mutex_create(&mMutexp, APR_THREAD_MUTEX_UNNESTED, mMutexPool); } - - return mPool ; } -LLVolatileAPRPool::LLVolatileAPRPool(apr_pool_t *parent, apr_size_t size, BOOL releasePoolFlag) - : LLAPRPool(parent, size, releasePoolFlag) + +LLVolatileAPRPool::~LLVolatileAPRPool() { - mNumActiveRef = 0 ; - mNumTotalRef = 0 ; + //delete mutex + if(mMutexp) + { + apr_thread_mutex_destroy(mMutexp); + apr_pool_destroy(mMutexPool); + } } -apr_pool_t* LLVolatileAPRPool::getVolatileAPRPool() +// +//define this virtual function to avoid any mistakenly calling LLAPRPool::getAPRPool(). +// +//virtual +apr_pool_t* LLVolatileAPRPool::getAPRPool() { + return LLVolatileAPRPool::getVolatileAPRPool() ; +} + +apr_pool_t* LLVolatileAPRPool::getVolatileAPRPool() +{ + LLScopedLock lock(mMutexp) ; + mNumTotalRef++ ; mNumActiveRef++ ; - return getAPRPool() ; + + if(!mPool) + { + createAPRPool() ; + } + + return mPool ; } void LLVolatileAPRPool::clearVolatileAPRPool() { + LLScopedLock lock(mMutexp) ; + if(mNumActiveRef > 0) { mNumActiveRef--; @@ -251,10 +284,9 @@ void LLScopedLock::unlock() bool ll_apr_warn_status(apr_status_t status) { if(APR_SUCCESS == status) return false; -#ifndef LL_WINDOWS char buf[MAX_STRING]; /* Flawfinder: ignore */ - LL_WARNS_ONCE("APR") << "APR: " << apr_strerror(status, buf, MAX_STRING) << LL_ENDL; -#endif + apr_strerror(status, buf, MAX_STRING); + LL_WARNS("APR") << "APR: " << buf << LL_ENDL; return true; } @@ -268,10 +300,18 @@ void ll_apr_assert_status(apr_status_t status) // LLAPRFile functions // LLAPRFile::LLAPRFile() + : mFile(NULL), + mCurrentFilePoolp(NULL) +{ +} + +LLAPRFile::LLAPRFile(const std::string& filename, apr_int32_t flags, LLVolatileAPRPool* pool) + : mFile(NULL), + mCurrentFilePoolp(NULL) { - mFile = NULL ; - mCurrentFilePoolp = NULL ; + open(filename, flags, pool); } + LLAPRFile::~LLAPRFile() { close() ; @@ -295,11 +335,40 @@ apr_status_t LLAPRFile::close() return ret ; } -apr_status_t LLAPRFile::open(LLVolatileAPRPool* pool, const std::string& filename, apr_int32_t flags, S32* sizep) +apr_status_t LLAPRFile::open(const std::string& filename, apr_int32_t flags, LLVolatileAPRPool* pool, S32* sizep) { apr_status_t s ; - s = open(filename, flags, pool ? pool->getVolatileAPRPool() : NULL, sizep) ; + + //check if already open some file + llassert_always(!mFile) ; + llassert_always(!mCurrentFilePoolp) ; + apr_pool_t* apr_pool = pool ? pool->getVolatileAPRPool() : NULL ; + s = apr_file_open(&mFile, filename.c_str(), flags, APR_OS_DEFAULT, getAPRFilePool(apr_pool)); + + if (s != APR_SUCCESS || !mFile) + { + mFile = NULL ; + + if (sizep) + { + *sizep = 0; + } + } + else if (sizep) + { + S32 file_size = 0; + apr_off_t offset = 0; + if (apr_file_seek(mFile, APR_END, &offset) == APR_SUCCESS) + { + llassert_always(offset <= 0x7fffffff); + file_size = (S32)offset; + offset = 0; + apr_file_seek(mFile, APR_SET, &offset); + } + *sizep = file_size; + } + if(!mCurrentFilePoolp) { mCurrentFilePoolp = pool ; @@ -312,40 +381,25 @@ apr_status_t LLAPRFile::open(LLVolatileAPRPool* pool, const std::string& filenam return s ; } -apr_status_t LLAPRFile::open(const std::string& filename, apr_int32_t flags, apr_pool_t* pool, S32* sizep) + +//use gAPRPoolp. +apr_status_t LLAPRFile::open(const std::string& filename, apr_int32_t flags, BOOL use_global_pool) { apr_status_t s; //check if already open some file llassert_always(!mFile) ; llassert_always(!mCurrentFilePoolp) ; + llassert_always(use_global_pool) ; //be aware of using gAPRPoolp. - s = apr_file_open(&mFile, filename.c_str(), flags, APR_OS_DEFAULT, getAPRFilePool(pool)); + s = apr_file_open(&mFile, filename.c_str(), flags, APR_OS_DEFAULT, gAPRPoolp); if (s != APR_SUCCESS || !mFile) { mFile = NULL ; close() ; - if (sizep) - { - *sizep = 0; - } return s; } - if (sizep) - { - S32 file_size = 0; - apr_off_t offset = 0; - if (apr_file_seek(mFile, APR_END, &offset) == APR_SUCCESS) - { - llassert_always(offset <= 0x7fffffff); - file_size = (S32)offset; - offset = 0; - apr_file_seek(mFile, APR_SET, &offset); - } - *sizep = file_size; - } - return s; } @@ -369,6 +423,7 @@ S32 LLAPRFile::read(void *buf, S32 nbytes) apr_status_t s = apr_file_read(mFile, buf, &sz); if (s != APR_SUCCESS) { + ll_apr_warn_status(s); return 0; } else @@ -386,6 +441,7 @@ S32 LLAPRFile::write(const void *buf, S32 nbytes) apr_status_t s = apr_file_write(mFile, buf, &sz); if (s != APR_SUCCESS) { + ll_apr_warn_status(s); return 0; } else @@ -434,6 +490,8 @@ apr_file_t* LLAPRFile::open(const std::string& filename, LLVolatileAPRPool* pool s = apr_file_open(&file_handle, filename.c_str(), flags, APR_OS_DEFAULT, pool->getVolatileAPRPool()); if (s != APR_SUCCESS || !file_handle) { + ll_apr_warn_status(s); + LL_WARNS("APR") << " Attempting to open filename: " << filename << LL_ENDL; file_handle = NULL ; close(file_handle, pool) ; return NULL; @@ -464,6 +522,7 @@ S32 LLAPRFile::seek(apr_file_t* file_handle, apr_seek_where_t where, S32 offset) } if (s != APR_SUCCESS) { + ll_apr_warn_status(s); return -1; } else @@ -501,6 +560,8 @@ S32 LLAPRFile::readEx(const std::string& filename, void *buf, S32 offset, S32 nb apr_status_t s = apr_file_read(file_handle, buf, &bytes_read); if (s != APR_SUCCESS) { + LL_WARNS("APR") << " Attempting to read filename: " << filename << LL_ENDL; + ll_apr_warn_status(s); bytes_read = 0; } else @@ -549,6 +610,8 @@ S32 LLAPRFile::writeEx(const std::string& filename, void *buf, S32 offset, S32 n apr_status_t s = apr_file_write(file_handle, buf, &bytes_written); if (s != APR_SUCCESS) { + LL_WARNS("APR") << " Attempting to write filename: " << filename << LL_ENDL; + ll_apr_warn_status(s); bytes_written = 0; } else @@ -575,8 +638,8 @@ bool LLAPRFile::remove(const std::string& filename, LLVolatileAPRPool* pool) if (s != APR_SUCCESS) { - LL_DEBUGS("APR") << "LLAPRFile::remove failed on file: " << filename << LL_ENDL; ll_apr_warn_status(s); + LL_WARNS("APR") << " Attempting to remove filename: " << filename << LL_ENDL; return false; } return true; @@ -593,8 +656,8 @@ bool LLAPRFile::rename(const std::string& filename, const std::string& newname, if (s != APR_SUCCESS) { - LL_DEBUGS("APR") << "LLAPRFile::rename failed on file: " << filename << LL_ENDL; ll_apr_warn_status(s); + LL_WARNS("APR") << " Attempting to rename filename: " << filename << LL_ENDL; return false; } return true; @@ -667,8 +730,8 @@ bool LLAPRFile::makeDir(const std::string& dirname, LLVolatileAPRPool* pool) if (s != APR_SUCCESS) { - LL_DEBUGS("APR") << "LLAPRFile::makeDir failed on file: " << dirname << LL_ENDL; ll_apr_warn_status(s); + LL_WARNS("APR") << " Attempting to make directory: " << dirname << LL_ENDL; return false; } return true; @@ -685,8 +748,8 @@ bool LLAPRFile::removeDir(const std::string& dirname, LLVolatileAPRPool* pool) if (s != APR_SUCCESS) { - LL_DEBUGS("APR") << "LLAPRFile::removeDir failed on file: " << dirname << LL_ENDL; ll_apr_warn_status(s); + LL_WARNS("APR") << " Attempting to remove directory: " << dirname << LL_ENDL; return false; } return true; diff --git a/indra/llcommon/llapr.h b/indra/llcommon/llapr.h index a1fcd2cf8d..b08bb617c5 100644 --- a/indra/llcommon/llapr.h +++ b/indra/llcommon/llapr.h @@ -70,9 +70,9 @@ class LL_COMMON_API LLAPRPool { public: LLAPRPool(apr_pool_t *parent = NULL, apr_size_t size = 0, BOOL releasePoolFlag = TRUE) ; - ~LLAPRPool() ; + virtual ~LLAPRPool() ; - apr_pool_t* getAPRPool() ; + virtual apr_pool_t* getAPRPool() ; apr_status_t getStatus() {return mStatus ; } protected: @@ -95,18 +95,21 @@ protected: class LL_COMMON_API LLVolatileAPRPool : public LLAPRPool { public: - LLVolatileAPRPool(apr_pool_t *parent = NULL, apr_size_t size = 0, BOOL releasePoolFlag = TRUE); - ~LLVolatileAPRPool(){} + LLVolatileAPRPool(BOOL is_local = TRUE, apr_pool_t *parent = NULL, apr_size_t size = 0, BOOL releasePoolFlag = TRUE); + virtual ~LLVolatileAPRPool(); - apr_pool_t* getVolatileAPRPool() ; - + /*virtual*/ apr_pool_t* getAPRPool() ; //define this virtual function to avoid any mistakenly calling LLAPRPool::getAPRPool(). + apr_pool_t* getVolatileAPRPool() ; void clearVolatileAPRPool() ; BOOL isFull() ; - BOOL isEmpty() {return !mNumActiveRef ;} + private: S32 mNumActiveRef ; //number of active pointers pointing to the apr_pool. - S32 mNumTotalRef ; //number of total pointers pointing to the apr_pool since last creating. + S32 mNumTotalRef ; //number of total pointers pointing to the apr_pool since last creating. + + apr_thread_mutex_t *mMutexp; + apr_pool_t *mMutexPool; } ; /** @@ -192,18 +195,21 @@ typedef LLAtomic32<S32> LLAtomicS32; // 1, a temperary pool passed to an APRFile function, which is used within this function and only once. // 2, a global pool. // -class LL_COMMON_API LLAPRFile + +class LL_COMMON_API LLAPRFile : boost::noncopyable { + // make this non copyable since a copy closes the file private: apr_file_t* mFile ; LLVolatileAPRPool *mCurrentFilePoolp ; //currently in use apr_pool, could be one of them: sAPRFilePoolp, or a temp pool. public: LLAPRFile() ; + LLAPRFile(const std::string& filename, apr_int32_t flags, LLVolatileAPRPool* pool = NULL); ~LLAPRFile() ; - - apr_status_t open(LLVolatileAPRPool* pool, const std::string& filename, apr_int32_t flags, S32* sizep = NULL); - apr_status_t open(const std::string& filename, apr_int32_t flags, apr_pool_t* pool = NULL, S32* sizep = NULL); + + apr_status_t open(const std::string& filename, apr_int32_t flags, LLVolatileAPRPool* pool = NULL, S32* sizep = NULL); + apr_status_t open(const std::string& filename, apr_int32_t flags, BOOL use_global_pool); //use gAPRPoolp. apr_status_t close() ; // Returns actual offset, -1 if seek fails @@ -217,8 +223,8 @@ public: apr_file_t* getFileHandle() {return mFile;} private: - apr_pool_t* getAPRFilePool(apr_pool_t* pool) ; - + apr_pool_t* getAPRFilePool(apr_pool_t* pool) ; + // //******************************************************************************************************************************* //static components diff --git a/indra/llcommon/llassettype.cpp b/indra/llcommon/llassettype.cpp index b2a92861cc..6d5b12d840 100644 --- a/indra/llcommon/llassettype.cpp +++ b/indra/llcommon/llassettype.cpp @@ -43,30 +43,21 @@ struct AssetEntry : public LLDictionaryEntry { AssetEntry(const char *desc_name, - const char *type_name, // 8 character limit! - const char *human_name, // for decoding to human readable form; put any and as many printable characters you want in each one - const char *category_name, // used by llinventorymodel when creating new categories - EDragAndDropType dad_type, - bool can_link, // can you create a link to this type? - bool is_protected) // can the viewer change categories of this type? + const char *type_name, // 8 character limit! + const char *human_name, // for decoding to human readable form; put any and as many printable characters you want in each one + bool can_link) // can you create a link to this type? : LLDictionaryEntry(desc_name), mTypeName(type_name), mHumanName(human_name), - mCategoryName(category_name), - mDadType(dad_type), - mCanLink(can_link), - mIsProtected(is_protected) + mCanLink(can_link) { llassert(strlen(mTypeName) <= 8); } const char *mTypeName; const char *mHumanName; - const char *mCategoryName; - EDragAndDropType mDadType; bool mCanLink; - bool mIsProtected; }; class LLAssetDictionary : public LLSingleton<LLAssetDictionary>, @@ -78,48 +69,32 @@ public: LLAssetDictionary::LLAssetDictionary() { - // DESCRIPTION TYPE NAME HUMAN NAME CATEGORY NAME DRAG&DROP CAN LINK? PROTECTED? - // |--------------------|-----------|-------------------|-------------------|---------------|-----------|-----------| - addEntry(LLAssetType::AT_TEXTURE, new AssetEntry("TEXTURE", "texture", "texture", "Textures", DAD_TEXTURE, TRUE, TRUE)); - addEntry(LLAssetType::AT_SOUND, new AssetEntry("SOUND", "sound", "sound", "Sounds", DAD_SOUND, TRUE, TRUE)); - addEntry(LLAssetType::AT_CALLINGCARD, new AssetEntry("CALLINGCARD", "callcard", "calling card", "Calling Cards", DAD_CALLINGCARD, TRUE, TRUE)); - addEntry(LLAssetType::AT_LANDMARK, new AssetEntry("LANDMARK", "landmark", "landmark", "Landmarks", DAD_LANDMARK, TRUE, TRUE)); - addEntry(LLAssetType::AT_SCRIPT, new AssetEntry("SCRIPT", "script", "legacy script", "Scripts", DAD_NONE, TRUE, TRUE)); - addEntry(LLAssetType::AT_CLOTHING, new AssetEntry("CLOTHING", "clothing", "clothing", "Clothing", DAD_CLOTHING, TRUE, TRUE)); - addEntry(LLAssetType::AT_OBJECT, new AssetEntry("OBJECT", "object", "object", "Objects", DAD_OBJECT, TRUE, TRUE)); - addEntry(LLAssetType::AT_NOTECARD, new AssetEntry("NOTECARD", "notecard", "note card", "Notecards", DAD_NOTECARD, TRUE, TRUE)); - addEntry(LLAssetType::AT_CATEGORY, new AssetEntry("CATEGORY", "category", "folder", "New Folder", DAD_CATEGORY, TRUE, TRUE)); - addEntry(LLAssetType::AT_ROOT_CATEGORY, new AssetEntry("ROOT_CATEGORY", "root", "root", "Inventory", DAD_ROOT_CATEGORY, TRUE, TRUE)); - addEntry(LLAssetType::AT_LSL_TEXT, new AssetEntry("LSL_TEXT", "lsltext", "lsl2 script", "Scripts", DAD_SCRIPT, TRUE, TRUE)); - addEntry(LLAssetType::AT_LSL_BYTECODE, new AssetEntry("LSL_BYTECODE", "lslbyte", "lsl bytecode", "Scripts", DAD_NONE, TRUE, TRUE)); - addEntry(LLAssetType::AT_TEXTURE_TGA, new AssetEntry("TEXTURE_TGA", "txtr_tga", "tga texture", "Uncompressed Images", DAD_NONE, TRUE, TRUE)); - addEntry(LLAssetType::AT_BODYPART, new AssetEntry("BODYPART", "bodypart", "body part", "Body Parts", DAD_BODYPART, TRUE, TRUE)); - addEntry(LLAssetType::AT_TRASH, new AssetEntry("TRASH", "trash", "trash", "Trash", DAD_NONE, FALSE, TRUE)); - addEntry(LLAssetType::AT_SNAPSHOT_CATEGORY, new AssetEntry("SNAPSHOT_CATEGORY", "snapshot", "snapshot", "Photo Album", DAD_NONE, FALSE, TRUE)); - addEntry(LLAssetType::AT_LOST_AND_FOUND, new AssetEntry("LOST_AND_FOUND", "lstndfnd", "lost and found", "Lost And Found", DAD_NONE, FALSE, TRUE)); - addEntry(LLAssetType::AT_SOUND_WAV, new AssetEntry("SOUND_WAV", "snd_wav", "sound", "Uncompressed SoundS", DAD_NONE, TRUE, TRUE)); - addEntry(LLAssetType::AT_IMAGE_TGA, new AssetEntry("IMAGE_TGA", "img_tga", "targa image", "Uncompressed Images", DAD_NONE, TRUE, TRUE)); - addEntry(LLAssetType::AT_IMAGE_JPEG, new AssetEntry("IMAGE_JPEG", "jpeg", "jpeg image", "Uncompressed Images", DAD_NONE, TRUE, TRUE)); - addEntry(LLAssetType::AT_ANIMATION, new AssetEntry("ANIMATION", "animatn", "animation", "Animations", DAD_ANIMATION, TRUE, TRUE)); - addEntry(LLAssetType::AT_GESTURE, new AssetEntry("GESTURE", "gesture", "gesture", "Gestures", DAD_GESTURE, TRUE, TRUE)); - addEntry(LLAssetType::AT_SIMSTATE, new AssetEntry("SIMSTATE", "simstate", "simstate", "New Folder", DAD_NONE, FALSE, TRUE)); - addEntry(LLAssetType::AT_FAVORITE, new AssetEntry("FAVORITE", "favorite", "favorite", "favorite", DAD_NONE, FALSE, TRUE)); - - addEntry(LLAssetType::AT_LINK, new AssetEntry("LINK", "link", "symbolic link", "Link", DAD_LINK, FALSE, TRUE)); - addEntry(LLAssetType::AT_LINK_FOLDER, new AssetEntry("FOLDER_LINK", "link_f", "symbolic folder link", "New Folder", DAD_LINK, FALSE, TRUE)); - - for (S32 ensemble_num = S32(LLAssetType::AT_FOLDER_ENSEMBLE_START); - ensemble_num <= S32(LLAssetType::AT_FOLDER_ENSEMBLE_END); - ensemble_num++) - { - addEntry(LLAssetType::EType(ensemble_num), new AssetEntry("ENSEMBLE", "ensemble", "ensemble", "New Folder", DAD_CATEGORY, FALSE, FALSE)); - } - - addEntry(LLAssetType::AT_CURRENT_OUTFIT, new AssetEntry("CURRENT", "current", "current outfit", "Current Look", DAD_CATEGORY, FALSE, TRUE)); - addEntry(LLAssetType::AT_OUTFIT, new AssetEntry("OUTFIT", "outfit", "outfit", "New Look", DAD_CATEGORY, FALSE, FALSE)); - addEntry(LLAssetType::AT_MY_OUTFITS, new AssetEntry("MY_OUTFITS", "my_otfts", "my outfits", "My Looks", DAD_CATEGORY, FALSE, TRUE)); - - addEntry(LLAssetType::AT_NONE, new AssetEntry("NONE", "-1", NULL, "New Folder", DAD_NONE, FALSE, FALSE)); + // DESCRIPTION TYPE NAME HUMAN NAME CAN LINK? + // |--------------------|-----------|-------------------|-----------| + addEntry(LLAssetType::AT_TEXTURE, new AssetEntry("TEXTURE", "texture", "texture", FALSE)); + addEntry(LLAssetType::AT_SOUND, new AssetEntry("SOUND", "sound", "sound", FALSE)); + addEntry(LLAssetType::AT_CALLINGCARD, new AssetEntry("CALLINGCARD", "callcard", "calling card", FALSE)); + addEntry(LLAssetType::AT_LANDMARK, new AssetEntry("LANDMARK", "landmark", "landmark", FALSE)); + addEntry(LLAssetType::AT_SCRIPT, new AssetEntry("SCRIPT", "script", "legacy script", FALSE)); + addEntry(LLAssetType::AT_CLOTHING, new AssetEntry("CLOTHING", "clothing", "clothing", TRUE)); + addEntry(LLAssetType::AT_OBJECT, new AssetEntry("OBJECT", "object", "object", TRUE)); + addEntry(LLAssetType::AT_NOTECARD, new AssetEntry("NOTECARD", "notecard", "note card", FALSE)); + addEntry(LLAssetType::AT_CATEGORY, new AssetEntry("CATEGORY", "category", "folder", TRUE)); + addEntry(LLAssetType::AT_LSL_TEXT, new AssetEntry("LSL_TEXT", "lsltext", "lsl2 script", FALSE)); + addEntry(LLAssetType::AT_LSL_BYTECODE, new AssetEntry("LSL_BYTECODE", "lslbyte", "lsl bytecode", FALSE)); + addEntry(LLAssetType::AT_TEXTURE_TGA, new AssetEntry("TEXTURE_TGA", "txtr_tga", "tga texture", FALSE)); + addEntry(LLAssetType::AT_BODYPART, new AssetEntry("BODYPART", "bodypart", "body part", TRUE)); + addEntry(LLAssetType::AT_SOUND_WAV, new AssetEntry("SOUND_WAV", "snd_wav", "sound", FALSE)); + addEntry(LLAssetType::AT_IMAGE_TGA, new AssetEntry("IMAGE_TGA", "img_tga", "targa image", FALSE)); + addEntry(LLAssetType::AT_IMAGE_JPEG, new AssetEntry("IMAGE_JPEG", "jpeg", "jpeg image", FALSE)); + addEntry(LLAssetType::AT_ANIMATION, new AssetEntry("ANIMATION", "animatn", "animation", FALSE)); + addEntry(LLAssetType::AT_GESTURE, new AssetEntry("GESTURE", "gesture", "gesture", TRUE)); + addEntry(LLAssetType::AT_SIMSTATE, new AssetEntry("SIMSTATE", "simstate", "simstate", FALSE)); + + addEntry(LLAssetType::AT_LINK, new AssetEntry("LINK", "link", "symbolic link", FALSE)); + addEntry(LLAssetType::AT_LINK_FOLDER, new AssetEntry("FOLDER_LINK", "link_f", "symbolic folder link", FALSE)); + + addEntry(LLAssetType::AT_NONE, new AssetEntry("NONE", "-1", NULL, FALSE)); }; // static @@ -140,8 +115,7 @@ const std::string &LLAssetType::getDesc(LLAssetType::EType asset_type) } else { - static const std::string error_string = "BAD TYPE"; - return error_string; + return badLookup(); } } @@ -156,7 +130,7 @@ const char *LLAssetType::lookup(LLAssetType::EType asset_type) } else { - return "-1"; + return badLookup().c_str(); } } @@ -166,6 +140,7 @@ LLAssetType::EType LLAssetType::lookup(const char* name) return lookup(ll_safe_string(name)); } +// static LLAssetType::EType LLAssetType::lookup(const std::string& type_name) { const LLAssetDictionary *dict = LLAssetDictionary::getInstance(); @@ -193,7 +168,7 @@ const char *LLAssetType::lookupHumanReadable(LLAssetType::EType asset_type) } else { - return NULL; + return badLookup().c_str(); } } @@ -203,6 +178,7 @@ LLAssetType::EType LLAssetType::lookupHumanReadable(const char* name) return lookupHumanReadable(ll_safe_string(name)); } +// static LLAssetType::EType LLAssetType::lookupHumanReadable(const std::string& readable_name) { const LLAssetDictionary *dict = LLAssetDictionary::getInstance(); @@ -220,32 +196,6 @@ LLAssetType::EType LLAssetType::lookupHumanReadable(const std::string& readable_ } // static -const char *LLAssetType::lookupCategoryName(LLAssetType::EType asset_type) -{ - const LLAssetDictionary *dict = LLAssetDictionary::getInstance(); - const AssetEntry *entry = dict->lookup(asset_type); - if (entry) - { - return entry->mCategoryName; - } - else - { - return "New Folder"; - } -} - -// static -EDragAndDropType LLAssetType::lookupDragAndDropType(EType asset_type) -{ - const LLAssetDictionary *dict = LLAssetDictionary::getInstance(); - const AssetEntry *entry = dict->lookup(asset_type); - if (entry) - return entry->mDadType; - else - return DAD_NONE; -} - -// static bool LLAssetType::lookupCanLink(EType asset_type) { const LLAssetDictionary *dict = LLAssetDictionary::getInstance(); @@ -269,37 +219,9 @@ bool LLAssetType::lookupIsLinkType(EType asset_type) } // static -// Only ensembles and plain folders aren't protected. "Protected" means -// you can't change certain properties such as their type. -bool LLAssetType::lookupIsProtectedCategoryType(EType asset_type) +const std::string &LLAssetType::badLookup() { - const LLAssetDictionary *dict = LLAssetDictionary::getInstance(); - const AssetEntry *entry = dict->lookup(asset_type); - if (entry) - { - return entry->mIsProtected; - } - return true; -} + static const std::string sBadLookup = "llassettype_bad_lookup"; + return sBadLookup; -// static -bool LLAssetType::lookupIsEnsembleCategoryType(EType asset_type) -{ - return (asset_type >= AT_FOLDER_ENSEMBLE_START && - asset_type <= AT_FOLDER_ENSEMBLE_END); -} - - -// static. Generate a good default description -void LLAssetType::generateDescriptionFor(LLAssetType::EType asset_type, - std::string& description) -{ - const S32 BUF_SIZE = 30; - char time_str[BUF_SIZE]; /* Flawfinder: ignore */ - time_t now; - time(&now); - memset(time_str, '\0', BUF_SIZE); - strftime(time_str, BUF_SIZE - 1, "%Y-%m-%d %H:%M:%S ", localtime(&now)); - description.assign(time_str); - description.append(LLAssetType::lookupHumanReadable(asset_type)); } diff --git a/indra/llcommon/llassettype.h b/indra/llcommon/llassettype.h index 3c760e4d91..ec2290d30e 100644 --- a/indra/llcommon/llassettype.h +++ b/indra/llcommon/llassettype.h @@ -94,18 +94,6 @@ public: AT_BODYPART = 13, // A collection of textures and parameters that can be worn by an avatar. - AT_TRASH = 14, - // Only to be used as a marker for a category preferred type. - // Using this, we can throw things in the trash before completely deleting. - - AT_SNAPSHOT_CATEGORY = 15, - // A marker for a folder meant for snapshots. - // No actual assets will be snapshots, though if there were, you - // could interpret them as textures. - - AT_LOST_AND_FOUND = 16, - // Used to stuff lost&found items into. - AT_SOUND_WAV = 17, // Uncompressed sound. @@ -126,38 +114,22 @@ public: AT_SIMSTATE = 22, // Simstate file. - AT_FAVORITE = 23, - // favorite items - AT_LINK = 24, // Inventory symbolic link AT_LINK_FOLDER = 25, // Inventory folder link - - AT_FOLDER_ENSEMBLE_START = 26, - AT_FOLDER_ENSEMBLE_END = 45, - // This range is reserved for special clothing folder types. - - AT_CURRENT_OUTFIT = 46, - // Current outfit - - AT_OUTFIT = 47, - // Predefined outfit ("look") - - AT_MY_OUTFITS = 48, - // Folder that holds your outfits. - - AT_COUNT = 49, + AT_COUNT = 26, // +*********************************************************+ // | TO ADD AN ELEMENT TO THIS ENUM: | // +*********************************************************+ // | 1. INSERT BEFORE AT_COUNT | // | 2. INCREMENT AT_COUNT BY 1 | - // | 3. ADD TO LLAssetDictionary in LLAssetType.cpp | - // | 3. ADD TO DEFAULT_ASSET_FOR_INV in LLInventoryType.cpp | + // | 3. ADD TO LLAssetType.cpp | + // | 4. ADD TO LLViewerAssetType.cpp | + // | 5. ADD TO DEFAULT_ASSET_FOR_INV in LLInventoryType.cpp | // +*********************************************************+ AT_NONE = -1 @@ -173,33 +145,17 @@ public: static EType lookupHumanReadable(const std::string& readable_name); static const char* lookupHumanReadable(EType asset_type); - // Generate a good default description. You may want to add a verb - // or agent name after this depending on your application. - static void generateDescriptionFor(LLAssetType::EType asset_type, - std::string& description); - static EType getType(const std::string& desc_name); static const std::string& getDesc(EType asset_type); - static EDragAndDropType lookupDragAndDropType(EType asset_type); static bool lookupCanLink(EType asset_type); static bool lookupIsLinkType(EType asset_type); - static const char* lookupCategoryName(EType asset_type); - static bool lookupIsProtectedCategoryType(EType asset_type); - static bool lookupIsEnsembleCategoryType(EType asset_type); - - /* TODO: Change return types from "const char *" to "const std::string &". - This is fairly straightforward, but requires changing some calls to use .c_str(). - e.g.: - - fprintf(fp, "\t\ttype\t%s\n", LLAssetType::lookup(mType)); - + fprintf(fp, "\t\ttype\t%s\n", LLAssetType::lookup(mType).c_str()); - */ - -private: - // don't instantiate or derive one of these objects - LLAssetType( void ) {} - ~LLAssetType( void ) {} + static const std::string& badLookup(); // error string when a lookup fails + +protected: + LLAssetType() {} + ~LLAssetType() {} }; #endif // LL_LLASSETTYPE_H diff --git a/indra/llcommon/llfoldertype.cpp b/indra/llcommon/llfoldertype.cpp new file mode 100644 index 0000000000..9107b11597 --- /dev/null +++ b/indra/llcommon/llfoldertype.cpp @@ -0,0 +1,165 @@ +/** + * @file llfoldertype.cpp + * @brief Implementatino of LLFolderType functionality. + * + * $LicenseInfo:firstyear=2001&license=viewergpl$ + * + * Copyright (c) 2001-2009, Linden Research, Inc. + * + * Second Life Viewer Source Code + * The source code in this file ("Source Code") is provided by Linden Lab + * to you under the terms of the GNU General Public License, version 2.0 + * ("GPL"), unless you have obtained a separate licensing agreement + * ("Other License"), formally executed by you and Linden Lab. Terms of + * the GPL can be found in doc/GPL-license.txt in this distribution, or + * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2 + * + * There are special exceptions to the terms and conditions of the GPL as + * it is applied to this Source Code. View the full text of the exception + * in the file doc/FLOSS-exception.txt in this software distribution, or + * online at + * http://secondlifegrid.net/programs/open_source/licensing/flossexception + * + * By copying, modifying or distributing this software, you acknowledge + * that you have read and understood your obligations described above, + * and agree to abide by those obligations. + * + * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO + * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, + * COMPLETENESS OR PERFORMANCE. + * $/LicenseInfo$ + */ + +#include "linden_common.h" + +#include "llfoldertype.h" +#include "lldictionary.h" +#include "llmemory.h" +#include "llsingleton.h" + +///---------------------------------------------------------------------------- +/// Class LLFolderType +///---------------------------------------------------------------------------- +struct FolderEntry : public LLDictionaryEntry +{ + FolderEntry(const std::string &type_name, // 8 character limit! + bool is_protected) // can the viewer change categories of this type? + : + LLDictionaryEntry(type_name), + mIsProtected(is_protected) + { + llassert(type_name.length() <= 8); + } + + const bool mIsProtected; +}; + +class LLFolderDictionary : public LLSingleton<LLFolderDictionary>, + public LLDictionary<LLFolderType::EType, FolderEntry> +{ +public: + LLFolderDictionary(); +}; + +LLFolderDictionary::LLFolderDictionary() +{ + // TYPE NAME PROTECTED + // |-----------|---------| + addEntry(LLFolderType::FT_TEXTURE, new FolderEntry("texture", TRUE)); + addEntry(LLFolderType::FT_SOUND, new FolderEntry("sound", TRUE)); + addEntry(LLFolderType::FT_CALLINGCARD, new FolderEntry("callcard", TRUE)); + addEntry(LLFolderType::FT_LANDMARK, new FolderEntry("landmark", TRUE)); + addEntry(LLFolderType::FT_CLOTHING, new FolderEntry("clothing", TRUE)); + addEntry(LLFolderType::FT_OBJECT, new FolderEntry("object", TRUE)); + addEntry(LLFolderType::FT_NOTECARD, new FolderEntry("notecard", TRUE)); + addEntry(LLFolderType::FT_CATEGORY, new FolderEntry("category", TRUE)); + addEntry(LLFolderType::FT_ROOT_CATEGORY, new FolderEntry("root", TRUE)); + addEntry(LLFolderType::FT_LSL_TEXT, new FolderEntry("lsltext", TRUE)); + addEntry(LLFolderType::FT_BODYPART, new FolderEntry("bodypart", TRUE)); + addEntry(LLFolderType::FT_TRASH, new FolderEntry("trash", TRUE)); + addEntry(LLFolderType::FT_SNAPSHOT_CATEGORY, new FolderEntry("snapshot", TRUE)); + addEntry(LLFolderType::FT_LOST_AND_FOUND, new FolderEntry("lstndfnd", TRUE)); + addEntry(LLFolderType::FT_ANIMATION, new FolderEntry("animatn", TRUE)); + addEntry(LLFolderType::FT_GESTURE, new FolderEntry("gesture", TRUE)); + addEntry(LLFolderType::FT_FAVORITE, new FolderEntry("favorite", TRUE)); + + for (S32 ensemble_num = S32(LLFolderType::FT_ENSEMBLE_START); ensemble_num <= S32(LLFolderType::FT_ENSEMBLE_END); ensemble_num++) + { + addEntry(LLFolderType::EType(ensemble_num), new FolderEntry("ensemble", FALSE)); + } + + addEntry(LLFolderType::FT_CURRENT_OUTFIT, new FolderEntry("current", TRUE)); + addEntry(LLFolderType::FT_OUTFIT, new FolderEntry("outfit", FALSE)); + addEntry(LLFolderType::FT_MY_OUTFITS, new FolderEntry("my_otfts", TRUE)); + addEntry(LLFolderType::FT_INBOX, new FolderEntry("inbox", TRUE)); + + addEntry(LLFolderType::FT_NONE, new FolderEntry("-1", FALSE)); +}; + +// static +LLFolderType::EType LLFolderType::lookup(const std::string& name) +{ + return LLFolderDictionary::getInstance()->lookup(name); +} + +// static +const std::string &LLFolderType::lookup(LLFolderType::EType folder_type) +{ + const FolderEntry *entry = LLFolderDictionary::getInstance()->lookup(folder_type); + if (entry) + { + return entry->mName; + } + else + { + return badLookup(); + } +} + +// static +// Only ensembles and plain folders aren't protected. "Protected" means +// you can't change certain properties such as their type. +bool LLFolderType::lookupIsProtectedType(EType folder_type) +{ + const LLFolderDictionary *dict = LLFolderDictionary::getInstance(); + const FolderEntry *entry = dict->lookup(folder_type); + if (entry) + { + return entry->mIsProtected; + } + return true; +} + +// static +bool LLFolderType::lookupIsEnsembleType(EType folder_type) +{ + return (folder_type >= FT_ENSEMBLE_START && + folder_type <= FT_ENSEMBLE_END); +} + +// static +LLAssetType::EType LLFolderType::folderTypeToAssetType(LLFolderType::EType folder_type) +{ + if (LLAssetType::lookup(LLAssetType::EType(folder_type)) == LLAssetType::badLookup()) + { + llwarns << "Converting to unknown asset type " << folder_type << llendl; + } + return (LLAssetType::EType)folder_type; +} + +// static +LLFolderType::EType LLFolderType::assetTypeToFolderType(LLAssetType::EType asset_type) +{ + if (LLFolderType::lookup(LLFolderType::EType(asset_type)) == LLFolderType::badLookup()) + { + llwarns << "Converting to unknown folder type " << asset_type << llendl; + } + return (LLFolderType::EType)asset_type; +} + +// static +const std::string &LLFolderType::badLookup() +{ + static const std::string sBadLookup = "llfoldertype_bad_lookup"; + return sBadLookup; +} diff --git a/indra/llcommon/llfoldertype.h b/indra/llcommon/llfoldertype.h new file mode 100644 index 0000000000..5374ffd829 --- /dev/null +++ b/indra/llcommon/llfoldertype.h @@ -0,0 +1,123 @@ +/** + * @file llfoldertype.h + * @brief Declaration of LLFolderType. + * + * $LicenseInfo:firstyear=2001&license=viewergpl$ + * + * Copyright (c) 2001-2009, Linden Research, Inc. + * + * Second Life Viewer Source Code + * The source code in this file ("Source Code") is provided by Linden Lab + * to you under the terms of the GNU General Public License, version 2.0 + * ("GPL"), unless you have obtained a separate licensing agreement + * ("Other License"), formally executed by you and Linden Lab. Terms of + * the GPL can be found in doc/GPL-license.txt in this distribution, or + * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2 + * + * There are special exceptions to the terms and conditions of the GPL as + * it is applied to this Source Code. View the full text of the exception + * in the file doc/FLOSS-exception.txt in this software distribution, or + * online at + * http://secondlifegrid.net/programs/open_source/licensing/flossexception + * + * By copying, modifying or distributing this software, you acknowledge + * that you have read and understood your obligations described above, + * and agree to abide by those obligations. + * + * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO + * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, + * COMPLETENESS OR PERFORMANCE. + * $/LicenseInfo$ + */ + +#ifndef LL_LLFOLDERTYPE_H +#define LL_LLFOLDERTYPE_H + +#include <string> +#include "llassettype.h" + +// This class handles folder types (similar to assettype, except for folders) +// and operations on those. +class LL_COMMON_API LLFolderType +{ +public: + // ! BACKWARDS COMPATIBILITY ! Folder type enums must match asset type enums. + enum EType + { + FT_TEXTURE = 0, + + FT_SOUND = 1, + + FT_CALLINGCARD = 2, + + FT_LANDMARK = 3, + + // FT_SCRIPT = 4, + + FT_CLOTHING = 5, + + FT_OBJECT = 6, + + FT_NOTECARD = 7, + + FT_CATEGORY = 8, + + FT_ROOT_CATEGORY = 9, + + FT_LSL_TEXT = 10, + + // FT_LSL_BYTECODE = 11, + // FT_TEXTURE_TGA = 12, + + FT_BODYPART = 13, + + FT_TRASH = 14, + + FT_SNAPSHOT_CATEGORY = 15, + + FT_LOST_AND_FOUND = 16, + + // FT_SOUND_WAV = 17, + // FT_IMAGE_TGA = 18, + // FT_IMAGE_JPEG = 19, + + FT_ANIMATION = 20, + + FT_GESTURE = 21, + + // FT_SIMSTATE = 22, + + FT_FAVORITE = 23, + + FT_ENSEMBLE_START = 26, + FT_ENSEMBLE_END = 45, + // This range is reserved for special clothing folder types. + + FT_CURRENT_OUTFIT = 46, + FT_OUTFIT = 47, + FT_MY_OUTFITS = 48, + + FT_INBOX = 49, + + FT_COUNT = 50, + + FT_NONE = -1 + }; + + static EType lookup(const std::string& type_name); + static const std::string& lookup(EType folder_type); + + static bool lookupIsProtectedType(EType folder_type); + static bool lookupIsEnsembleType(EType folder_type); + + static LLAssetType::EType folderTypeToAssetType(LLFolderType::EType folder_type); + static LLFolderType::EType assetTypeToFolderType(LLAssetType::EType asset_type); + + static const std::string& badLookup(); // error string when a lookup fails + +protected: + LLFolderType() {} + ~LLFolderType() {} +}; + +#endif // LL_LLFOLDERTYPE_H diff --git a/indra/llcommon/llqueuedthread.cpp b/indra/llcommon/llqueuedthread.cpp index 3db5c36545..395d298887 100644 --- a/indra/llcommon/llqueuedthread.cpp +++ b/indra/llcommon/llqueuedthread.cpp @@ -42,7 +42,8 @@ LLQueuedThread::LLQueuedThread(const std::string& name, bool threaded) : LLThread(name), mThreaded(threaded), mIdleThread(TRUE), - mNextHandle(0) + mNextHandle(0), + mStarted(FALSE) { if (mThreaded) { @@ -53,6 +54,10 @@ LLQueuedThread::LLQueuedThread(const std::string& name, bool threaded) : // MAIN THREAD LLQueuedThread::~LLQueuedThread() { + if (!mThreaded) + { + endThread(); + } shutdown(); // ~LLThread() will be called here } @@ -106,6 +111,11 @@ void LLQueuedThread::shutdown() // virtual S32 LLQueuedThread::update(U32 max_time_ms) { + if (!mStarted) + { + startThread(); + mStarted = TRUE; + } return updateQueue(max_time_ms); } @@ -452,26 +462,12 @@ S32 LLQueuedThread::processNextRequest() } } - S32 res; S32 pending = getPending(); - if (pending == 0) - { - if (isQuitting()) - { - res = -1; // exit thread - } - else - { - res = 0; - } - } - else - { - res = pending; - } - return res; + + return pending; } +// virtual bool LLQueuedThread::runCondition() { // mRunCondition must be locked here @@ -481,35 +477,53 @@ bool LLQueuedThread::runCondition() return true; } +// virtual void LLQueuedThread::run() { + // call checPause() immediately so we don't try to do anything before the class is fully constructed + checkPause(); + startThread(); + mStarted = TRUE; + while (1) { // this will block on the condition until runCondition() returns true, the thread is unpaused, or the thread leaves the RUNNING state. checkPause(); - if(isQuitting()) + if (isQuitting()) + { + endThread(); break; - - //llinfos << "QUEUED THREAD RUNNING, queue size = " << mRequestQueue.size() << llendl; + } mIdleThread = FALSE; + + threadedUpdate(); int res = processNextRequest(); if (res == 0) { mIdleThread = TRUE; + ms_sleep(1); } - - if (res < 0) // finished working and want to exit - { - break; - } - //LLThread::yield(); // thread should yield after each request } + llinfos << "LLQueuedThread " << mName << " EXITING." << llendl; +} - llinfos << "QUEUED THREAD " << mName << " EXITING." << llendl; +// virtual +void LLQueuedThread::startThread() +{ +} + +// virtual +void LLQueuedThread::endThread() +{ +} + +// virtual +void LLQueuedThread::threadedUpdate() +{ } //============================================================================ diff --git a/indra/llcommon/llqueuedthread.h b/indra/llcommon/llqueuedthread.h index 8bfa5632a1..9a9dbb18cc 100644 --- a/indra/llcommon/llqueuedthread.h +++ b/indra/llcommon/llqueuedthread.h @@ -166,6 +166,9 @@ private: virtual bool runCondition(void); virtual void run(void); + virtual void startThread(void); + virtual void endThread(void); + virtual void threadedUpdate(void); protected: handle_t generateHandle(); @@ -200,6 +203,7 @@ public: protected: BOOL mThreaded; // if false, run on main thread and do updates during update() + BOOL mStarted; // required when mThreaded is false to call startThread() from update() LLAtomic32<BOOL> mIdleThread; // request queue is empty (or we are quitting) and the thread is idle typedef std::set<QueuedRequest*, queued_request_less> request_queue_t; diff --git a/indra/llcommon/llthread.h b/indra/llcommon/llthread.h index c3d7650bd9..932d96d940 100644 --- a/indra/llcommon/llthread.h +++ b/indra/llcommon/llthread.h @@ -33,9 +33,7 @@ #ifndef LL_LLTHREAD_H #define LL_LLTHREAD_H -#include "llapr.h" #include "llapp.h" - #include "apr_thread_cond.h" class LLThread; diff --git a/indra/llcommon/llworkerthread.cpp b/indra/llcommon/llworkerthread.cpp index 5dda600755..82c736266d 100644 --- a/indra/llcommon/llworkerthread.cpp +++ b/indra/llcommon/llworkerthread.cpp @@ -201,6 +201,7 @@ LLWorkerClass::~LLWorkerClass() { llassert_always(!(mWorkFlags & WCF_WORKING)); llassert_always(mWorkFlags & WCF_DELETE_REQUESTED); + llassert_always(!mMutex.isLocked()); if (mRequestHandle != LLWorkerThread::nullHandle()) { LLWorkerThread::WorkRequest* workreq = (LLWorkerThread::WorkRequest*)mWorkerThread->getRequest(mRequestHandle); diff --git a/indra/llcommon/llworkerthread.h b/indra/llcommon/llworkerthread.h index a12bd52a64..a1e85d2ecc 100644 --- a/indra/llcommon/llworkerthread.h +++ b/indra/llcommon/llworkerthread.h @@ -52,6 +52,7 @@ class LLWorkerClass; class LL_COMMON_API LLWorkerThread : public LLQueuedThread { + friend class LLWorkerClass; public: class WorkRequest : public LLQueuedThread::QueuedRequest { @@ -92,8 +93,11 @@ public: handle_t addWorkRequest(LLWorkerClass* workerclass, S32 param, U32 priority = PRIORITY_NORMAL); - void deleteWorker(LLWorkerClass* workerclass); // schedule for deletion S32 getNumDeletes() { return (S32)mDeleteList.size(); } // debug + +private: + void deleteWorker(LLWorkerClass* workerclass); // schedule for deletion + }; //============================================================================ |