Fixed problem where a variable was not being initialized and removed some unnecessary synchronization.

This commit is contained in:
Juan Carlos Luciani 2006-04-06 16:57:23 +00:00
parent 020df3ec99
commit eac83cbbb2

View File

@ -60,10 +60,7 @@ typedef struct _ConfigIfInstance
//===[ Global variables ]================================================== //===[ Global variables ]==================================================
// ConfigIf synchronization mutex and variables // ConfigIf variables
static
pthread_mutex_t g_configIfMutex = PTHREAD_MUTEX_INITIALIZER;
static static
LIST_ENTRY g_configIfListHead = {&g_configIfListHead, &g_configIfListHead}; LIST_ENTRY g_configIfListHead = {&g_configIfListHead, &g_configIfListHead};
@ -171,7 +168,7 @@ SkipNonWhiteSpace(
// L2 // L2
//=======================================================================-- //=======================================================================--
{ {
char *pOutString; char *pOutString = (char*) pInString;
DbgTrace(3, "auth_token -SkipNonWhiteSpace- Start\n", 0); DbgTrace(3, "auth_token -SkipNonWhiteSpace- Start\n", 0);
@ -258,10 +255,8 @@ ConfigIf_AddReference(
DbgTrace(2, "auth_token -ConfigIf_AddReference- Start\n", 0); DbgTrace(2, "auth_token -ConfigIf_AddReference- Start\n", 0);
// Increment the reference count on the object // Increment the reference count on the object
pthread_mutex_lock(&g_configIfMutex);
pConfigIfInstance->refCount ++; pConfigIfInstance->refCount ++;
refCount = pConfigIfInstance->refCount; refCount = pConfigIfInstance->refCount;
pthread_mutex_unlock(&g_configIfMutex);
DbgTrace(2, "auth_token -ConfigIf_AddReference- End, refCount = %08X\n", refCount); DbgTrace(2, "auth_token -ConfigIf_AddReference- End, refCount = %08X\n", refCount);
@ -295,7 +290,6 @@ ConfigIf_ReleaseReference(
// Decrement the reference count on the object and determine if it needs to // Decrement the reference count on the object and determine if it needs to
// be released. // be released.
pthread_mutex_lock(&g_configIfMutex);
pConfigIfInstance->refCount --; pConfigIfInstance->refCount --;
if (pConfigIfInstance->refCount == 0) if (pConfigIfInstance->refCount == 0)
{ {
@ -304,7 +298,6 @@ ConfigIf_ReleaseReference(
g_numConfigIfObjs --; g_numConfigIfObjs --;
RemoveEntryList(&pConfigIfInstance->listEntry); RemoveEntryList(&pConfigIfInstance->listEntry);
} }
pthread_mutex_unlock(&g_configIfMutex);
// Free object if necessary // Free object if necessary
if (freeObj) if (freeObj)
@ -462,9 +455,6 @@ GetConfigInterface(
DbgTrace(2, "auth_token -GetConfigInterface- Start\n", 0); DbgTrace(2, "auth_token -GetConfigInterface- Start\n", 0);
// Obtain exclusive access to our mutex
pthread_mutex_lock(&g_configIfMutex);
// Check if we already have an entry in our list for the configuration // Check if we already have an entry in our list for the configuration
pListEntry = g_configIfListHead.Flink; pListEntry = g_configIfListHead.Flink;
while (pListEntry != &g_configIfListHead) while (pListEntry != &g_configIfListHead)
@ -681,9 +671,6 @@ GetConfigInterface(
} }
} }
// Release exclusive access to our mutex
pthread_mutex_unlock(&g_configIfMutex);
DbgTrace(2, "auth_token -GetConfigInterface- End, retStatus = %08X\n", retStatus); DbgTrace(2, "auth_token -GetConfigInterface- End, retStatus = %08X\n", retStatus);
return retStatus; return retStatus;