Prepare synchronization with viewer-development.
Synchronization will be complete after viewer-development gets my LLAPRPool and LLAPRFile patch that I'm currently working on.
This commit is contained in:
@@ -88,7 +88,7 @@ bool ll_apr_warn_status(apr_status_t status)
|
|||||||
|
|
||||||
void ll_apr_assert_status(apr_status_t status)
|
void ll_apr_assert_status(apr_status_t status)
|
||||||
{
|
{
|
||||||
llassert(ll_apr_warn_status(status) == false);
|
llassert(!ll_apr_warn_status(status));
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------
|
//---------------------------------------------------------------------
|
||||||
@@ -146,7 +146,7 @@ apr_status_t LLAPRFile::open(std::string const& filename, apr_int32_t flags, acc
|
|||||||
|
|
||||||
apr_status_t status;
|
apr_status_t status;
|
||||||
{
|
{
|
||||||
apr_pool_t* apr_file_open_pool;
|
apr_pool_t* apr_file_open_pool; // The use of apr_pool_t is OK here.
|
||||||
// This is a temporary variable for a pool that is passed directly to apr_file_open below.
|
// This is a temporary variable for a pool that is passed directly to apr_file_open below.
|
||||||
if (access_type == short_lived)
|
if (access_type == short_lived)
|
||||||
{
|
{
|
||||||
@@ -199,7 +199,6 @@ apr_status_t LLAPRFile::open(const std::string& filename, apr_int32_t flags, BOO
|
|||||||
// File I/O
|
// File I/O
|
||||||
S32 LLAPRFile::read(void *buf, S32 nbytes)
|
S32 LLAPRFile::read(void *buf, S32 nbytes)
|
||||||
{
|
{
|
||||||
//llassert_always(mFile); (ASC-TUDCC) -HgB
|
|
||||||
if(!mFile)
|
if(!mFile)
|
||||||
{
|
{
|
||||||
llwarns << "apr mFile is removed by somebody else. Can not read." << llendl ;
|
llwarns << "apr mFile is removed by somebody else. Can not read." << llendl ;
|
||||||
@@ -222,7 +221,6 @@ S32 LLAPRFile::read(void *buf, S32 nbytes)
|
|||||||
|
|
||||||
S32 LLAPRFile::write(const void *buf, S32 nbytes)
|
S32 LLAPRFile::write(const void *buf, S32 nbytes)
|
||||||
{
|
{
|
||||||
// llassert_always(mFile); (ASC-TUDCC) -HgB
|
|
||||||
if(!mFile)
|
if(!mFile)
|
||||||
{
|
{
|
||||||
llwarns << "apr mFile is removed by somebody else. Can not write." << llendl ;
|
llwarns << "apr mFile is removed by somebody else. Can not write." << llendl ;
|
||||||
|
|||||||
@@ -113,7 +113,7 @@ typedef LLAtomic32<U32> LLAtomicU32;
|
|||||||
typedef LLAtomic32<S32> LLAtomicS32;
|
typedef LLAtomic32<S32> LLAtomicS32;
|
||||||
|
|
||||||
// File IO convenience functions.
|
// File IO convenience functions.
|
||||||
// Returns NULL if the file fails to openm sets *sizep to file size of not NULL
|
// Returns NULL if the file fails to open, sets *sizep to file size if not NULL
|
||||||
// abbreviated flags
|
// abbreviated flags
|
||||||
#define LL_APR_R (APR_READ) // "r"
|
#define LL_APR_R (APR_READ) // "r"
|
||||||
#define LL_APR_W (APR_CREATE|APR_TRUNCATE|APR_WRITE) // "w"
|
#define LL_APR_W (APR_CREATE|APR_TRUNCATE|APR_WRITE) // "w"
|
||||||
@@ -131,7 +131,7 @@ typedef LLAtomic32<S32> LLAtomicS32;
|
|||||||
// especially do not put some time-costly operations between open() and close().
|
// especially do not put some time-costly operations between open() and close().
|
||||||
// otherwise it might lock the APRFilePool.
|
// otherwise it might lock the APRFilePool.
|
||||||
//there are two different apr_pools the APRFile can use:
|
//there are two different apr_pools the APRFile can use:
|
||||||
// 1, a temperary pool passed to an APRFile function, which is used within this function and only once.
|
// 1, a temporary pool passed to an APRFile function, which is used within this function and only once.
|
||||||
// 2, a global pool.
|
// 2, a global pool.
|
||||||
//
|
//
|
||||||
|
|
||||||
@@ -189,7 +189,7 @@ public:
|
|||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Function which approprately logs error or remains quiet on
|
* @brief Function which appropriately logs error or remains quiet on
|
||||||
* APR_SUCCESS.
|
* APR_SUCCESS.
|
||||||
* @return Returns <code>true</code> if status is an error condition.
|
* @return Returns <code>true</code> if status is an error condition.
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -60,9 +60,9 @@ extern void ll_init_apr();
|
|||||||
class LL_COMMON_API LLAPRPool
|
class LL_COMMON_API LLAPRPool
|
||||||
{
|
{
|
||||||
protected:
|
protected:
|
||||||
apr_pool_t* mPool; //!< Pointer to the underlaying pool. NULL if not initialized.
|
apr_pool_t* mPool; //!< Pointer to the underlaying pool. NULL if not initialized.
|
||||||
LLAPRPool* mParent; //!< Pointer to the parent pool, if any. Only valid when mPool is non-zero.
|
LLAPRPool* mParent; //!< Pointer to the parent pool, if any. Only valid when mPool is non-zero.
|
||||||
apr_os_thread_t mOwner; //!< The thread that owns this memory pool. Only valid when mPool is non-zero.
|
apr_os_thread_t mOwner; //!< The thread that owns this memory pool. Only valid when mPool is non-zero.
|
||||||
|
|
||||||
public:
|
public:
|
||||||
//! Construct an uninitialized (destructed) pool.
|
//! Construct an uninitialized (destructed) pool.
|
||||||
|
|||||||
@@ -399,6 +399,15 @@ LLMutexBase::LLMutexBase() :
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool LLMutexBase::isSelfLocked() const
|
||||||
|
{
|
||||||
|
#if LL_DARWIN
|
||||||
|
return mLockingThread == LLThread::currentID();
|
||||||
|
#else
|
||||||
|
return mLockingThread == local_thread_ID;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
void LLMutexBase::lock()
|
void LLMutexBase::lock()
|
||||||
{
|
{
|
||||||
#if LL_DARWIN
|
#if LL_DARWIN
|
||||||
@@ -431,7 +440,7 @@ void LLMutexBase::unlock()
|
|||||||
|
|
||||||
apr_thread_mutex_unlock(mAPRMutexp);
|
apr_thread_mutex_unlock(mAPRMutexp);
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
|
|
||||||
//static
|
//static
|
||||||
|
|||||||
@@ -73,7 +73,7 @@ class LL_COMMON_API LLThread
|
|||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
static U32 sIDIter;
|
static U32 sIDIter;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
typedef enum e_thread_status
|
typedef enum e_thread_status
|
||||||
{
|
{
|
||||||
@@ -179,13 +179,17 @@ public:
|
|||||||
|
|
||||||
LLMutexBase() ;
|
LLMutexBase() ;
|
||||||
|
|
||||||
void lock(); //blocks
|
void lock(); // blocks
|
||||||
void unlock();
|
void unlock();
|
||||||
// Returns true if lock was obtained successfully.
|
// Returns true if lock was obtained successfully.
|
||||||
bool tryLock() { return !APR_STATUS_IS_EBUSY(apr_thread_mutex_trylock(mAPRMutexp)); }
|
bool tryLock() { return !APR_STATUS_IS_EBUSY(apr_thread_mutex_trylock(mAPRMutexp)); }
|
||||||
|
|
||||||
// non-blocking, but does do a lock/unlock so not free
|
// non-blocking, but does do a lock/unlock so not free
|
||||||
bool isLocked() { bool is_not_locked = tryLock(); if (is_not_locked) unlock(); return !is_not_locked; }
|
bool isLocked() { bool is_not_locked = tryLock(); if (is_not_locked) unlock(); return !is_not_locked; }
|
||||||
|
|
||||||
|
// Returns true if locked by this thread.
|
||||||
|
bool isSelfLocked() const;
|
||||||
|
|
||||||
// get ID of locking thread
|
// get ID of locking thread
|
||||||
U32 lockingThread() const { return mLockingThread; }
|
U32 lockingThread() const { return mLockingThread; }
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user