ICU-770 Add some documentation.
X-SVN-Rev: 5850
This commit is contained in:
parent
138f5f9bdb
commit
b19e723440
@ -19,18 +19,42 @@
|
||||
|
||||
#include "unicode/utypes.h"
|
||||
|
||||
enum ECleanupLibraryType {
|
||||
/** These are the functions used to register a library's memory cleanup
|
||||
* functions. Each library should define a single library register function
|
||||
* to call this API. In the i18n library, it is ucln_i18n_registerCleanup().
|
||||
*
|
||||
* None of the cleanup functions should not use a mutex to clean up an API's
|
||||
* allocated memory because a cleanup function is not meant to be thread safe,
|
||||
* and plenty of data cannot be reference counted in order to make sure that
|
||||
* no one else needs the allocated data.
|
||||
*
|
||||
* In order to make a cleanup function get called when u_cleanup is called,
|
||||
* You should add your function to the library specific cleanup function.
|
||||
* If the cleanup function is not in the common library, the code that
|
||||
* allocates the memory should call the library specific cleanup function.
|
||||
* For instance, in the i18n library, any memory allocated statically must
|
||||
* call ucln_i18n_registerCleanup() from the ucln_in.h header. These library
|
||||
* cleanup functions are needed in order to prevent a circular dependency
|
||||
* between the common library and any other library.
|
||||
*
|
||||
* The order of the cleanup is very important. In general, an API that
|
||||
* depends on a second API should be cleaned up before the second API.
|
||||
* For instance, the default converter in ustring depends upon the converter
|
||||
* API. So the default converter should be closed before the converter API
|
||||
* has its cache flushed. This will prevent any memory leaks due to
|
||||
* reference counting.
|
||||
*
|
||||
* Please see common/ucln_cmn.{h,c} and i18n/ucln_in.{h,c} for examples.
|
||||
*/
|
||||
|
||||
typedef enum ECleanupLibraryType {
|
||||
UCLN_START = -1,
|
||||
UCLN_CUSTOM, /* Custom is for anyone else. */
|
||||
UCLN_LAYOUT,
|
||||
UCLN_USTDIO,
|
||||
UCLN_I18N,
|
||||
UCLN_COMMON /* This must be the last one to cleanup. */
|
||||
};
|
||||
|
||||
#ifndef XP_CPLUSPLUS
|
||||
typedef enum ECleanupLibraryType ECleanupLibraryType;
|
||||
#endif
|
||||
} ECleanupLibraryType;
|
||||
|
||||
typedef UBool cleanupFunc(void);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user