28 #ifdef LIBVLC_USE_PTHREAD
33 GCRY_THREAD_OPTION_PTHREAD_IMPL;
34 # define gcry_threads_vlc gcry_threads_pthread
41 static int gcry_vlc_mutex_init(
void **p_sys )
43 vlc_mutex_t *p_lock = (vlc_mutex_t *)malloc(
sizeof( vlc_mutex_t ) );
47 vlc_mutex_init( p_lock );
52 static int gcry_vlc_mutex_destroy(
void **p_sys )
54 vlc_mutex_t *p_lock = (vlc_mutex_t *)*p_sys;
55 vlc_mutex_destroy( p_lock );
60 static int gcry_vlc_mutex_lock(
void **p_sys )
62 vlc_mutex_lock( (vlc_mutex_t *)*p_sys );
66 static int gcry_vlc_mutex_unlock(
void **lock )
68 vlc_mutex_unlock( (vlc_mutex_t *)*lock );
72 static const struct gcry_thread_cbs gcry_threads_vlc =
74 GCRY_THREAD_OPTION_USER,
77 gcry_vlc_mutex_destroy,
79 gcry_vlc_mutex_unlock,
80 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL
87 static inline void vlc_gcrypt_init (
void)
94 static bool done =
false;
96 vlc_global_lock (VLC_GCRYPT_MUTEX);
99 gcry_control (GCRYCTL_SET_THREAD_CBS, &gcry_threads_vlc);
102 vlc_global_unlock (VLC_GCRYPT_MUTEX);
#define VLC_SUCCESS
Definition: vlc_common.h:373