PolarSSL v1.3.4
threading.h
Go to the documentation of this file.
1 
27 #ifndef POLARSSL_THREADING_H
28 #define POLARSSL_THREADING_H
29 
30 #include "config.h"
31 
32 #include <stdlib.h>
33 
34 #ifdef __cplusplus
35 extern "C" {
36 #endif
37 
38 #define POLARSSL_ERR_THREADING_FEATURE_UNAVAILABLE -0x001A
39 #define POLARSSL_ERR_THREADING_BAD_INPUT_DATA -0x001C
40 #define POLARSSL_ERR_THREADING_MUTEX_ERROR -0x001E
42 #if defined(POLARSSL_THREADING_PTHREAD)
43 #include <pthread.h>
44 typedef pthread_mutex_t threading_mutex_t;
45 #endif
46 
47 #if defined(POLARSSL_THREADING_ALT)
48 /* You should define the threading_mutex_t type in your header */
49 #include "threading_alt.h"
50 
62 int threading_set_alt( int (*mutex_init)( threading_mutex_t * ),
63  int (*mutex_free)( threading_mutex_t * ),
64  int (*mutex_lock)( threading_mutex_t * ),
65  int (*mutex_unlock)( threading_mutex_t * ) );
66 #endif /* POLARSSL_THREADING_ALT_C */
67 
68 /*
69  * The function pointers for mutex_init, mutex_free, mutex_ and mutex_unlock
70  *
71  * All these functions are expected to work or the result will be undefined.
72  */
73 extern int (*polarssl_mutex_init)( threading_mutex_t *mutex );
74 extern int (*polarssl_mutex_free)( threading_mutex_t *mutex );
75 extern int (*polarssl_mutex_lock)( threading_mutex_t *mutex );
76 extern int (*polarssl_mutex_unlock)( threading_mutex_t *mutex );
77 
78 #ifdef __cplusplus
79 }
80 #endif
81 
82 #endif /* threading.h */
int(* polarssl_mutex_lock)(threading_mutex_t *mutex)
Configuration options (set of defines)
int(* polarssl_mutex_free)(threading_mutex_t *mutex)
int(* polarssl_mutex_unlock)(threading_mutex_t *mutex)
int(* polarssl_mutex_init)(threading_mutex_t *mutex)