| Index: source/common/ucln_cmn.cpp
|
| diff --git a/source/common/ucln_cmn.c b/source/common/ucln_cmn.cpp
|
| similarity index 84%
|
| rename from source/common/ucln_cmn.c
|
| rename to source/common/ucln_cmn.cpp
|
| index 0c04b0d7f910cf26a7aec4328bc24b9e1a8fa0bf..2480c9d3fd27e2514ed0a59168966033a74dedd8 100644
|
| --- a/source/common/ucln_cmn.c
|
| +++ b/source/common/ucln_cmn.cpp
|
| @@ -1,9 +1,9 @@
|
| /*
|
| ******************************************************************************
|
| -* Copyright (C) 2001-2013, International Business Machines
|
| +* Copyright (C) 2001-2014, International Business Machines
|
| * Corporation and others. All Rights Reserved.
|
| ******************************************************************************
|
| -* file name: ucln_cmn.c
|
| +* file name: ucln_cmn.cpp
|
| * encoding: US-ASCII
|
| * tab size: 8 (not used)
|
| * indentation:4
|
| @@ -14,12 +14,13 @@
|
|
|
| #include "unicode/utypes.h"
|
| #include "unicode/uclean.h"
|
| -#include "utracimp.h"
|
| -#include "ucln_cmn.h"
|
| -#include "cmutex.h"
|
| -#include "ucln.h"
|
| #include "cmemory.h"
|
| +#include "mutex.h"
|
| #include "uassert.h"
|
| +#include "ucln.h"
|
| +#include "ucln_cmn.h"
|
| +#include "utracimp.h"
|
| +#include "umutex.h"
|
|
|
| /** Auto-client for UCLN_COMMON **/
|
| #define UCLN_TYPE_IS_COMMON
|
| @@ -65,6 +66,7 @@ ucln_common_registerCleanup(ECleanupCommonType type,
|
| U_ASSERT(UCLN_COMMON_START < type && type < UCLN_COMMON_COUNT);
|
| if (UCLN_COMMON_START < type && type < UCLN_COMMON_COUNT)
|
| {
|
| + icu::Mutex m; // See ticket 10295 for discussion.
|
| gCommonCleanupFunctions[type] = func;
|
| }
|
| #if !UCLN_NO_AUTO_CLEANUP && (defined(UCLN_AUTO_ATEXIT) || defined(UCLN_AUTO_LOCAL))
|
| @@ -72,6 +74,10 @@ ucln_common_registerCleanup(ECleanupCommonType type,
|
| #endif
|
| }
|
|
|
| +// Note: ucln_registerCleanup() is called with the ICU global mutex locked.
|
| +// Be aware if adding anything to the function.
|
| +// See ticket 10295 for discussion.
|
| +
|
| U_CAPI void U_EXPORT2
|
| ucln_registerCleanup(ECleanupLibraryType type,
|
| cleanupFunc *func)
|
| @@ -84,11 +90,11 @@ ucln_registerCleanup(ECleanupLibraryType type,
|
| }
|
|
|
| U_CFUNC UBool ucln_lib_cleanup(void) {
|
| - ECleanupLibraryType libType = UCLN_START;
|
| - ECleanupCommonType commonFunc = UCLN_COMMON_START;
|
| + int32_t libType = UCLN_START;
|
| + int32_t commonFunc = UCLN_COMMON_START;
|
|
|
| for (libType++; libType<UCLN_COMMON; libType++) {
|
| - ucln_cleanupOne(libType);
|
| + ucln_cleanupOne(static_cast<ECleanupLibraryType>(libType));
|
| }
|
|
|
| for (commonFunc++; commonFunc<UCLN_COMMON_COUNT; commonFunc++) {
|
|
|