1 // Copyright (C) 2016 and later: Unicode, Inc. and others.
2 // License & terms of use: http://www.unicode.org/copyright.html
4 ******************************************************************************
6 * Copyright (C) 2001-2014, International Business Machines *
7 * Corporation and others. All Rights Reserved. *
9 ******************************************************************************
10 * file name: ucln_in.cpp
12 * tab size: 8 (not used)
15 * created on: 2001July05
16 * created by: George Rhoten
24 /** Auto-client for UCLN_I18N **/
25 #define UCLN_TYPE UCLN_I18N
28 /* Leave this copyright notice here! It needs to go somewhere in this library. */
29 static const char copyright[] = U_COPYRIGHT_STRING;
31 static cleanupFunc *gCleanupFunctions[UCLN_I18N_COUNT];
33 static UBool U_CALLCONV i18n_cleanup(void)
35 int32_t libType = UCLN_I18N_START;
36 (void)copyright; /* Suppress unused variable warning with clang. */
38 while (++libType<UCLN_I18N_COUNT) {
39 if (gCleanupFunctions[libType])
41 gCleanupFunctions[libType]();
42 gCleanupFunctions[libType] = NULL;
45 #if !UCLN_NO_AUTO_CLEANUP && (defined(UCLN_AUTO_ATEXIT) || defined(UCLN_AUTO_LOCAL))
46 ucln_unRegisterAutomaticCleanup();
51 void ucln_i18n_registerCleanup(ECleanupI18NType type,
53 U_ASSERT(UCLN_I18N_START < type && type < UCLN_I18N_COUNT);
55 icu::Mutex m; // See ticket 10295 for discussion.
56 ucln_registerCleanup(UCLN_I18N, i18n_cleanup);
57 if (UCLN_I18N_START < type && type < UCLN_I18N_COUNT) {
58 gCleanupFunctions[type] = func;
61 #if !UCLN_NO_AUTO_CLEANUP && (defined(UCLN_AUTO_ATEXIT) || defined(UCLN_AUTO_LOCAL))
62 ucln_registerAutomaticCleanup();