Changes due to continue development of the IpcLibs. Not done yet.
This commit is contained in:
@@ -100,33 +100,45 @@ extern pthread_mutex_t interlockedMutex;
|
||||
__inline static unsigned long
|
||||
InterlockedIncrement(unsigned long *pValue)
|
||||
{
|
||||
unsigned long retVal;
|
||||
pthread_mutex_lock(&interlockedMutex);
|
||||
*pValue ++;
|
||||
(*pValue) ++;
|
||||
retVal = *pValue;
|
||||
pthread_mutex_unlock(&interlockedMutex);
|
||||
return retVal;
|
||||
}
|
||||
|
||||
__inline static unsigned long
|
||||
InterlockedDecrement(unsigned long *pValue)
|
||||
{
|
||||
unsigned long retVal;
|
||||
pthread_mutex_lock(&interlockedMutex);
|
||||
*pValue --;
|
||||
(*pValue) --;
|
||||
retVal = *pValue;
|
||||
pthread_mutex_unlock(&interlockedMutex);
|
||||
return retVal;
|
||||
}
|
||||
|
||||
__inline static uint32_t
|
||||
InterlockedIncrement(uint32_t *pValue)
|
||||
{
|
||||
uint32_t retVal;
|
||||
pthread_mutex_lock(&interlockedMutex);
|
||||
*pValue ++;
|
||||
(*pValue) ++;
|
||||
retVal = *pValue;
|
||||
pthread_mutex_unlock(&interlockedMutex);
|
||||
return retVal;
|
||||
}
|
||||
|
||||
__inline static uint32_t
|
||||
InterlockedDecrement(uint32_t *pValue)
|
||||
{
|
||||
uint32_t retVal;
|
||||
pthread_mutex_lock(&interlockedMutex);
|
||||
*pValue --;
|
||||
(*pValue) --;
|
||||
retVal = *pValue;
|
||||
pthread_mutex_unlock(&interlockedMutex);
|
||||
return retVal;
|
||||
}
|
||||
|
||||
//===[ Include files ]=====================================================
|
||||
|
||||
@@ -18,8 +18,6 @@
|
||||
* To contact Novell about this file by physical or electronic mail,
|
||||
* you may find current contact information at www.novell.com.
|
||||
*
|
||||
* Author: Juan Carlos Luciani <jluciani@novell.com>
|
||||
*
|
||||
***********************************************************************/
|
||||
|
||||
#ifndef SMARTPTR_H
|
||||
@@ -56,12 +54,12 @@ class ObjRef
|
||||
|
||||
void IncRefCount(void)
|
||||
{
|
||||
InterlockedIncrement((unsigned long*)&m_Count);
|
||||
InterlockedIncrement(&m_Count);
|
||||
}
|
||||
|
||||
bool DecRefCount(void)
|
||||
{
|
||||
if ((m_Count > 0) && (InterlockedDecrement((unsigned long*)&m_Count) == 0))
|
||||
if ((m_Count > 0) && (InterlockedDecrement(&m_Count) == 0))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
@@ -81,9 +79,7 @@ class ObjRef
|
||||
//
|
||||
private:
|
||||
|
||||
// BUGBUG!! - Need to put a lock in here so the count can be updated atomically.
|
||||
// or use an interlocked inc/dec if one exists.
|
||||
mutable unsigned int m_Count;
|
||||
mutable unsigned long m_Count;
|
||||
|
||||
};
|
||||
|
||||
@@ -273,8 +269,8 @@ inline void SmartPtr<T>::resetPtr(T* newPtr)
|
||||
|
||||
} // End of SmartPtr::resetPtr()
|
||||
|
||||
|
||||
#endif // SMARTPTR_H
|
||||
|
||||
/******************************************************************************/
|
||||
/******************************************************************************/
|
||||
|
||||
|
||||
Reference in New Issue
Block a user