1ARES_LIBRARY_CLEANUP(3)    Library Functions Manual    ARES_LIBRARY_CLEANUP(3)
2
3
4

NAME

6       ares_library_cleanup - c-ares library deinitialization
7

SYNOPSIS

9       #include <ares.h>
10
11       void ares_library_cleanup(void)
12
13       cc file.c -lcares
14

DESCRIPTION

16       The  ares_library_cleanup  function  uninitializes  the c-ares library,
17       freeing all resources previously acquired by ares_library_init(3)  when
18       the library was initialized.
19
20       This  function  must  be  called  when the program using c-ares will no
21       longer  need  any  c-ares  function.  Once  the  program   has   called
22       ares_library_cleanup(3)  it  shall  not make any further call to any c-
23       ares function.
24
25       This function does not cancel any pending c-ares  lookups  or  requests
26       previously done. Program  must use ares_cancel(3) for this purpose.
27
28       This function is not thread safe.  You have to call it once the program
29       is about to terminate, but this call must be done once the program  has
30       terminated  every  single  thread that it could have initiated. This is
31       required to avoid potential race conditions  in  library  deinitializa‐
32       tion,  and also due to the fact that ares_library_cleanup(3) might call
33       functions from other libraries that are thread unsafe, and  could  con‐
34       flict  with  any  other  thread  that  is  already  using  these  other
35       libraries.
36
37       Win32/64 application DLLs shall not call  ares_library_cleanup(3)  from
38       the  DllMain  function. Doing so will produce deadlocks and other prob‐
39       lems.
40

AVAILABILITY

42       This function was first introduced in c-ares version 1.7.0  along  with
43       the  definition  of preprocessor symbol CARES_HAVE_ARES_LIBRARY_CLEANUP
44       as an indication of the availability of this function.
45
46       Since the introduction of this function, it is absolutely mandatory  to
47       call it for any Win32/64 program using c-ares.
48
49       Non-Win32/64 systems can still use c-ares version 1.7.0 without calling
50       ares_library_cleanup(3) due to the fact that currently it is  nearly  a
51       do-nothing function on non-Win32/64 platforms.
52

SEE ALSO

54       ares_library_init(3), ares_cancel(3)
55

AUTHOR

57       Yang Tse
58
59       Copyright 1998 by the Massachusetts Institute of Technology.
60       Copyright (C) 2004-2009 by Daniel Stenberg.
61
62
63
64                                  19 May 2009          ARES_LIBRARY_CLEANUP(3)
Impressum