PolarSSL v1.3.2
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_DUMMY)
43 typedef void threading_mutex_t;
44 #endif
45 
46 #if defined(POLARSSL_THREADING_PTHREAD)
47 #include <pthread.h>
48 typedef pthread_mutex_t threading_mutex_t;
49 #endif
50 
51 #if defined(POLARSSL_THREADING_ALT)
52 /* You should define the threading_mutex_t type in your header */
53 #include "threading_alt.h"
54 
66 int threading_set_alt( int (*mutex_init)( threading_mutex_t * ),
67  int (*mutex_free)( threading_mutex_t * ),
68  int (*mutex_lock)( threading_mutex_t * ),
69  int (*mutex_unlock)( threading_mutex_t * ) );
70 #endif /* POLARSSL_THREADING_ALT_C */
71 
72 /*
73  * The function pointers for mutex_init, mutex_free, mutex_ and mutex_unlock
74  *
75  * All these functions are expected to work or the result will be undefined.
76  */
77 extern int (*polarssl_mutex_init)( threading_mutex_t *mutex );
78 extern int (*polarssl_mutex_free)( threading_mutex_t *mutex );
79 extern int (*polarssl_mutex_lock)( threading_mutex_t *mutex );
80 extern int (*polarssl_mutex_unlock)( threading_mutex_t *mutex );
81 
82 #ifdef __cplusplus
83 }
84 #endif
85 
86 #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)