]>
Commit | Line | Data |
---|---|---|
b75a7d8f A |
1 | /* |
2 | ****************************************************************************** | |
3 | * * | |
4 | * Copyright (C) 2001-2003, International Business Machines * | |
5 | * Corporation and others. All Rights Reserved. * | |
6 | * * | |
7 | ****************************************************************************** | |
8 | * file name: uclean.h | |
9 | * encoding: US-ASCII | |
10 | * tab size: 8 (not used) | |
11 | * indentation:4 | |
12 | * | |
13 | * created on: 2001July05 | |
14 | * created by: George Rhoten | |
15 | */ | |
16 | ||
17 | #ifndef __UCLEAN_H__ | |
18 | #define __UCLEAN_H__ | |
19 | ||
20 | #include "unicode/utypes.h" | |
21 | ||
22 | /** | |
23 | * Initialize ICU. This function loads and initializes data items | |
24 | * that are required internally by various ICU functions. Use of this explicit | |
25 | * initialization is required in multi-threaded applications; in | |
26 | * single threaded apps, use is optional, but incurs little additional | |
27 | * cost, and is thus recommended. | |
28 | * <p> | |
29 | * In multi-threaded applications, u_init() should be called in the | |
30 | * main thread before starting additional threads, or, alternatively | |
31 | * it can be called in each individual thread once, before other ICU | |
32 | * functions are called in that thread. In this second scenario, the | |
33 | * application must guarantee that the first call to u_init() happen | |
34 | * without contention, in a single thread only. | |
35 | * <p> | |
36 | * Extra, repeated, or otherwise unneeded calls to u_init() do no harm, | |
37 | * other than taking a small amount of time. | |
38 | * | |
39 | * @param pErrorCode An ICU UErrorCode parameter. It must not be <code>NULL</code>. | |
40 | * An Error will be returned if some required part of ICU data can not | |
41 | * be loaded or initialized. | |
42 | * The function returns immediately if the input error code indicates a | |
43 | * failure, as usual. | |
44 | * | |
45 | * @draft ICU 2.6 | |
46 | */ | |
47 | U_CAPI void U_EXPORT2 | |
48 | u_init(UErrorCode *status); | |
49 | ||
50 | /** | |
51 | * Clean up the system resources, such as allocated memory or open files, | |
52 | * used in all ICU libraries. This will free/delete all memory owned by the | |
53 | * ICU libraries, and return them to their original load state. All open ICU | |
54 | * items (collators, resource bundles, converters, etc.) must be closed before | |
55 | * calling this function, otherwise ICU may not free its allocated memory | |
56 | * (e.g. close your converters and resource bundles before calling this | |
57 | * function). Generally, this function should be called once just before | |
58 | * an application exits. For applications that dynamically load and unload | |
59 | * the ICU libraries (relatively uncommon), u_cleanup() should be called | |
60 | * just before the library unload. | |
61 | * <p> | |
62 | * u_cleanup() is not thread safe. All other threads should stop using ICU | |
63 | * before calling this function. | |
64 | * <p> | |
65 | * Any open ICU items will be left in an undefined state by u_cleanup(), | |
66 | * and any subsequent attempt to use such an item will give unpredictable | |
67 | * results. | |
68 | * <p> | |
69 | * After calling u_cleanup(), an application may continue to use ICU by | |
70 | * calling u_init(). An application must invoke u_init() first from one single | |
71 | * thread before allowing other threads call u_init(). All threads existing | |
72 | * at the time of the first thread's call to u_init() must also call | |
73 | * u_init() themselves before continuing with other ICU operations. | |
74 | * <p> | |
75 | * The use of u_cleanup() just before an application terminates is optional, | |
76 | * but it should be called only once for performance reasons. The primary | |
77 | * benefit is to eliminate reports of memory or resource leaks originating | |
78 | * in ICU code from the results generated by heap analysis tools. | |
79 | * <p> | |
80 | * <strong>Use this function with great care!</strong> | |
81 | * </p> | |
82 | * | |
83 | * @stable ICU 2.0 | |
84 | * @system | |
85 | */ | |
86 | U_CAPI void U_EXPORT2 | |
87 | u_cleanup(void); | |
88 | ||
89 | #endif |