1 |
/* this is libspopc.c file, part of the libspopc library sources |
2 |
* copyright © 2002- Benoit Rouits <brouits@free.fr> |
3 |
* released under the terms of the GNU Lesser General Public Licence. |
4 |
* |
5 |
* libspopc offers simple API for a pop3 client. |
6 |
* See RFC 1725 for pop3 specifications. |
7 |
* more information on http://herewe.servebeer.com/libspopc/ |
8 |
* |
9 |
* This library is free software; you can redistribute it and/or |
10 |
* modify it under the terms of the GNU Lesser General Public |
11 |
* License as published by the Free Software Foundation; either |
12 |
* version 2.1 of the License, or (at your option) any later version. |
13 |
* |
14 |
* This library is distributed in the hope that it will be useful, |
15 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
16 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
17 |
* Lesser General Public License for more details. |
18 |
* |
19 |
* You should have received a copy of the GNU Lesser General Public |
20 |
* License along with this library; if not, write to the Free Software |
21 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
22 |
*/ |
23 |
|
24 |
#include "libspopc.h" |
25 |
#include "mutex.h" |
26 |
|
27 |
static int LIBSPOPC_UP = 0; |
28 |
|
29 |
/* all mutexes are defined here */ |
30 |
mutex GETHOSTBYNAME; |
31 |
|
32 |
/* ALL THESE FUNCTIONS MUST BE CALLED ONCE AT A TIME */ |
33 |
|
34 |
/* initialize libspopc, mainly for thread safety */ |
35 |
int libspopc_init(void) |
36 |
{ |
37 |
if (!LIBSPOPC_UP) |
38 |
{ |
39 |
/* initialize all mutexes */ |
40 |
mutex_init(&GETHOSTBYNAME); |
41 |
} |
42 |
LIBSPOPC_UP = 1; |
43 |
return 0; /* FIXME */ |
44 |
} |
45 |
|
46 |
/* clean libspopc, thus re-initable by libspopc_init() */ |
47 |
int libspopc_clean(void) |
48 |
{ |
49 |
if(LIBSPOPC_UP) |
50 |
{ |
51 |
/* clean all mutexes */ |
52 |
mutex_clean(&GETHOSTBYNAME); |
53 |
} |
54 |
LIBSPOPC_UP = 0; |
55 |
return 0; /* FIXME */ |
56 |
} |
57 |
|