ICU-3786 Fix file for non-debug Windows builds

X-SVN-Rev: 15758
This commit is contained in:
George Rhoten 2004-06-07 18:37:01 +00:00
parent 2ff0f49369
commit 973d616ed9

View File

@ -124,7 +124,7 @@ static CRITICAL_SECTION gGlobalWinMutex;
* one function, e.g., to perform a custom action, followed by a * one function, e.g., to perform a custom action, followed by a
* standard call to EnterCriticalSection. * standard call to EnterCriticalSection.
*/ */
#if defined(_DEBUG) && (ICU_USE_THREADS==1) #if defined(U_DEBUG) && (ICU_USE_THREADS==1)
static int32_t gRecursionCount = 0; /* detect global mutex locking */ static int32_t gRecursionCount = 0; /* detect global mutex locking */
static int32_t gRecursionCountPool[MAX_MUTEXES]; /* ditto for non-global */ static int32_t gRecursionCountPool[MAX_MUTEXES]; /* ditto for non-global */
#endif #endif
@ -214,7 +214,7 @@ umtx_lock(UMTX *mutex)
#endif /* ICU_USE_THREADS==1 */ #endif /* ICU_USE_THREADS==1 */
} }
#if defined(WIN32) && defined(_DEBUG) && (ICU_USE_THREADS==1) #if defined(WIN32) && defined(U_DEBUG) && (ICU_USE_THREADS==1)
if (mutex == &gGlobalMutex) { /* Detect Reentrant locking of the global mutex. */ if (mutex == &gGlobalMutex) { /* Detect Reentrant locking of the global mutex. */
gRecursionCount++; /* Recursion causes deadlocks on Unixes. */ gRecursionCount++; /* Recursion causes deadlocks on Unixes. */
U_ASSERT(gRecursionCount == 1); /* Detection works on Windows. Debug problems there. */ U_ASSERT(gRecursionCount == 1); /* Detection works on Windows. Debug problems there. */
@ -234,7 +234,7 @@ umtx_lock(UMTX *mutex)
U_ASSERT(((CRITICAL_SECTION*)*mutex)->RecursionCount == 1); U_ASSERT(((CRITICAL_SECTION*)*mutex)->RecursionCount == 1);
*/ */
} }
#endif /*_DEBUG*/ #endif /*U_DEBUG*/
} }
@ -254,7 +254,7 @@ umtx_unlock(UMTX* mutex)
return; return;
} }
#if defined (WIN32) && defined (_DEBUG) && (ICU_USE_THREADS==1) #if defined (WIN32) && defined (U_DEBUG) && (ICU_USE_THREADS==1)
if (mutex == &gGlobalMutex) { if (mutex == &gGlobalMutex) {
gRecursionCount--; gRecursionCount--;
U_ASSERT(gRecursionCount == 0); /* Detect unlock of an already unlocked mutex */ U_ASSERT(gRecursionCount == 0); /* Detect unlock of an already unlocked mutex */
@ -329,7 +329,9 @@ static void initGlobalMutex() {
int i; int i;
for (i=0; i<MAX_MUTEXES; i++) { for (i=0; i<MAX_MUTEXES; i++) {
InitializeCriticalSection(&gMutexes[i]); InitializeCriticalSection(&gMutexes[i]);
#if defined (U_DEBUG)
gRecursionCountPool[i] = 0; /* see comments above */ gRecursionCountPool[i] = 0; /* see comments above */
#endif
} }
gMutexPoolInitialized = TRUE; gMutexPoolInitialized = TRUE;
} }