2 * Copyright (C) 2010-2012 Free Software Foundation, Inc.
4 * Author: Nikos Mavrogiannopoulos
6 * This file is part of GnuTLS.
8 * The GnuTLS is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Lesser General Public License
10 * as published by the Free Software Foundation; either version 3 of
11 * the License, or (at your option) any later version.
13 * This library is distributed in the hope that it will be useful, but
14 * WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * Lesser General Public License for more details.
18 * You should have received a copy of the GNU Lesser General Public License
19 * along with this program. If not, see <http://www.gnu.org/licenses/>
23 #include <gnutls_int.h>
24 #include <gnutls_errors.h>
26 #include <gnutls_dh.h>
33 * gnutls_global_set_mutex:
34 * @init: mutex initialization function
35 * @deinit: mutex deinitialization function
36 * @lock: mutex locking function
37 * @unlock: mutex unlocking function
39 * With this function you are allowed to override the default mutex
40 * locks used in some parts of gnutls and dependent libraries. This function
41 * should be used if you have complete control of your program and libraries.
42 * Do not call this function from a library. Instead only initialize gnutls and
43 * the default OS mutex locks will be used.
45 * This function must be called before gnutls_global_init().
50 gnutls_global_set_mutex (mutex_init_func init
, mutex_deinit_func deinit
,
51 mutex_lock_func lock
, mutex_unlock_func unlock
)
53 if (init
== NULL
|| deinit
== NULL
|| lock
== NULL
|| unlock
== NULL
)
56 gnutls_mutex_init
= init
;
57 gnutls_mutex_deinit
= deinit
;
58 gnutls_mutex_lock
= lock
;
59 gnutls_mutex_unlock
= unlock
;