~ubuntu-branches/ubuntu/gutsy/icu/gutsy-updates

« back to all changes in this revision

Viewing changes to source/common/ucln_cmn.c

  • Committer: Package Import Robot
  • Author(s): Jay Berkenbilt
  • Date: 2005-11-19 11:29:31 UTC
  • mfrom: (1.1.2)
  • Revision ID: package-import@ubuntu.com-20051119112931-vcizkrp10tli4enw
Tags: 3.4-3
Explicitly build with g++ 3.4.  The current ICU fails its test suite
with 4.0 but not with 3.4.  Future versions should work properly with
4.0.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/*
2
 
******************************************************************************
3
 
*                                                                            *
4
 
* Copyright (C) 2001-2001, International Business Machines                   *
5
 
*                Corporation and others. All Rights Reserved.                *
6
 
*                                                                            *
7
 
******************************************************************************
8
 
*   file name:  ucln_cmn.c
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
 
#include "unicode/uclean.h"
18
 
#include "ucln_cmn.h"
19
 
#include "umutex.h"
20
 
#include "ucln.h"
21
 
 
22
 
static cleanupFunc *gCleanupFunctions[UCLN_COMMON] = {
23
 
    NULL,
24
 
    NULL,
25
 
    NULL
26
 
};
27
 
 
28
 
U_CAPI void U_EXPORT2
29
 
ucln_registerCleanup(ECleanupLibraryType type,
30
 
                     cleanupFunc *func)
31
 
{
32
 
    if (UCLN_START < type && type < UCLN_COMMON)
33
 
    {
34
 
        gCleanupFunctions[type] = func;
35
 
    }
36
 
}
37
 
 
38
 
U_CAPI void U_EXPORT2
39
 
u_cleanup(void)
40
 
{
41
 
 
42
 
    ECleanupLibraryType libType = UCLN_START;
43
 
    while (++libType < UCLN_COMMON)
44
 
    {
45
 
        if (gCleanupFunctions[libType])
46
 
        {
47
 
            gCleanupFunctions[libType]();
48
 
        }
49
 
 
50
 
    }
51
 
    unorm_cleanup();
52
 
    unames_cleanup();
53
 
    uchar_cleanup();
54
 
    locale_cleanup();
55
 
    uloc_cleanup();
56
 
    ustring_cleanup();
57
 
    UnicodeConverter_cleanup(); /* <-- deprecated code */
58
 
    ucnv_cleanup();
59
 
    ucnv_io_cleanup();
60
 
    ures_cleanup();
61
 
    udata_cleanup();
62
 
    putil_cleanup();
63
 
 
64
 
    /*
65
 
     * WARNING! Destroying the global mutex can cause synchronization
66
 
     * problems.  ICU must be reinitialized from a single thread
67
 
     * before the library is used again.  You never want two
68
 
     * threads trying to initialize the global mutex at the same
69
 
     * time. The global mutex is being destroyed so that heap and
70
 
     * resource checkers don't complain. [grhoten]
71
 
     */
72
 
    umtx_destroy(NULL);
73
 
}
74