]>
git.saurik.com Git - apple/icu.git/blob - icuSources/io/ucln_io.cpp
2 ******************************************************************************
4 * Copyright (C) 2001-2014, International Business Machines *
5 * Corporation and others. All Rights Reserved. *
7 ******************************************************************************
8 * file name: ucln_io.cpp
10 * tab size: 8 (not used)
13 * created on: 2006August11
14 * created by: George Rhoten
22 #ifndef U_IO_IMPLEMENTATION
23 #error U_IO_IMPLEMENTATION not set - must be set for all ICU source files in io/ - see http://userguide.icu-project.org/howtouseicu
28 #define UCLN_TYPE UCLN_IO
31 /* Leave this copyright notice here! It needs to go somewhere in this library. */
32 static const char copyright
[] = U_COPYRIGHT_STRING
;
34 static cleanupFunc
*gCleanupFunctions
[UCLN_IO_COUNT
];
36 static UBool
io_cleanup(void)
38 int32_t libType
= UCLN_IO_START
;
40 (void)copyright
; // Suppress unused variable warning.
41 while (++libType
<UCLN_IO_COUNT
) {
42 if (gCleanupFunctions
[libType
])
44 gCleanupFunctions
[libType
]();
45 gCleanupFunctions
[libType
] = NULL
;
48 #if !UCLN_NO_AUTO_CLEANUP && (defined(UCLN_AUTO_ATEXIT) || defined(UCLN_AUTO_LOCAL))
49 ucln_unRegisterAutomaticCleanup();
54 void ucln_io_registerCleanup(ECleanupIOType type
,
56 U_ASSERT(UCLN_IO_START
< type
&& type
< UCLN_IO_COUNT
);
58 icu::Mutex m
; // See ticket 10295 for discussion.
59 ucln_registerCleanup(UCLN_IO
, io_cleanup
);
60 if (UCLN_IO_START
< type
&& type
< UCLN_IO_COUNT
) {
61 gCleanupFunctions
[type
] = func
;
65 #if !UCLN_NO_AUTO_CLEANUP && (defined(UCLN_AUTO_ATEXIT) || defined(UCLN_AUTO_LOCAL))
66 ucln_registerAutomaticCleanup();