]>
git.saurik.com Git - apple/icu.git/blob - icuSources/io/ucln_io.cpp
1 // © 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_io.cpp
12 * tab size: 8 (not used)
15 * created on: 2006August11
16 * created by: George Rhoten
19 #include "unicode/utypes.h"
25 #ifndef U_IO_IMPLEMENTATION
26 #error U_IO_IMPLEMENTATION not set - must be set for all ICU source files in io/ - see http://userguide.icu-project.org/howtouseicu
31 #define UCLN_TYPE UCLN_IO
34 /* Leave this copyright notice here! It needs to go somewhere in this library. */
35 static const char copyright
[] = U_COPYRIGHT_STRING
;
37 static cleanupFunc
*gCleanupFunctions
[UCLN_IO_COUNT
];
39 static UBool U_CALLCONV
io_cleanup(void)
41 int32_t libType
= UCLN_IO_START
;
43 (void)copyright
; // Suppress unused variable warning.
44 while (++libType
<UCLN_IO_COUNT
) {
45 if (gCleanupFunctions
[libType
])
47 gCleanupFunctions
[libType
]();
48 gCleanupFunctions
[libType
] = NULL
;
51 #if !UCLN_NO_AUTO_CLEANUP && (defined(UCLN_AUTO_ATEXIT) || defined(UCLN_AUTO_LOCAL))
52 ucln_unRegisterAutomaticCleanup();
57 void ucln_io_registerCleanup(ECleanupIOType type
,
59 U_ASSERT(UCLN_IO_START
< type
&& type
< UCLN_IO_COUNT
);
61 icu::Mutex m
; // See ticket 10295 for discussion.
62 ucln_registerCleanup(UCLN_IO
, io_cleanup
);
63 if (UCLN_IO_START
< type
&& type
< UCLN_IO_COUNT
) {
64 gCleanupFunctions
[type
] = func
;
68 #if !UCLN_NO_AUTO_CLEANUP && (defined(UCLN_AUTO_ATEXIT) || defined(UCLN_AUTO_LOCAL))
69 ucln_registerAutomaticCleanup();