update for beta universally
[external/c-ares.git] / ares_library_cleanup.3
1 .\"
2 .\" Copyright 1998 by the Massachusetts Institute of Technology.
3 .\" Copyright (C) 2004-2009 by Daniel Stenberg
4 .\"
5 .\" Permission to use, copy, modify, and distribute this
6 .\" software and its documentation for any purpose and without
7 .\" fee is hereby granted, provided that the above copyright
8 .\" notice appear in all copies and that both that copyright
9 .\" notice and this permission notice appear in supporting
10 .\" documentation, and that the name of M.I.T. not be used in
11 .\" advertising or publicity pertaining to distribution of the
12 .\" software without specific, written prior permission.
13 .\" M.I.T. makes no representations about the suitability of
14 .\" this software for any purpose.  It is provided "as is"
15 .\" without express or implied warranty.
16 .\"
17 .TH ARES_LIBRARY_CLEANUP 3 "19 May 2009"
18 .SH NAME
19 ares_library_cleanup \- c-ares library deinitialization
20 .SH SYNOPSIS
21 .nf
22 .B #include <ares.h>
23 .PP
24 .B void ares_library_cleanup(void)
25 .PP
26 .B cc file.c -lcares
27 .fi
28 .SH DESCRIPTION
29 .PP
30 The
31 .B ares_library_cleanup
32 function uninitializes the c-ares library, freeing all resources
33 previously acquired by \fIares_library_init(3)\fP when the library
34 was initialized.
35 .PP
36 This function must be called when the program using c-ares will
37 no longer need any c-ares function. Once the program has called
38 \fIares_library_cleanup(3)\fP it shall not make any further call to any
39 c-ares function.
40 .PP
41 This function does not cancel any pending c-ares lookups or requests
42 previously done. Program  must use \fIares_cancel(3)\fP for this purpose.
43 .PP
44 .B This function is not thread safe.
45 You have to call it once the program is about to terminate, but this call must
46 be done once the program has terminated every single thread that it could have
47 initiated. This is required to avoid potential race conditions in library
48 deinitialization, and also due to the fact that \fIares_library_cleanup(3)\fP
49 might call functions from other libraries that are thread unsafe, and could
50 conflict with any other thread that is already using these other libraries.
51 .PP
52 Win32/64 application DLLs shall not call \fIares_library_cleanup(3)\fP from
53 the DllMain function. Doing so will produce deadlocks and other problems.
54 .SH AVAILABILITY
55 This function was first introduced in c-ares version 1.7.0 along with the
56 definition of preprocessor symbol \fICARES_HAVE_ARES_LIBRARY_CLEANUP\fP as an
57 indication of the availability of this function.
58 .PP
59 Since the introduction of this function, it is absolutely mandatory to call it
60 for any Win32/64 program using c-ares.
61 .PP
62 Non-Win32/64 systems can still use c-ares version 1.7.0 without calling
63 \fIares_library_cleanup(3)\fP due to the fact that \fIcurrently\fP it is nearly
64 a do-nothing function on non-Win32/64 platforms.
65 .SH SEE ALSO
66 .BR ares_library_init(3),
67 .BR ares_cancel(3)
68 .SH AUTHOR
69 Yang Tse
70 .PP
71 Copyright 1998 by the Massachusetts Institute of Technology.
72 .br
73 Copyright (C) 2004-2009 by Daniel Stenberg.