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