PolarSSL v1.3.9
threading.h
Go to the documentation of this file.
1
27#ifndef POLARSSL_THREADING_H
28#define POLARSSL_THREADING_H
29
30#if !defined(POLARSSL_CONFIG_FILE)
31#include "config.h"
32#else
33#include POLARSSL_CONFIG_FILE
34#endif
35
36#include <stdlib.h>
37
38#ifdef __cplusplus
39extern "C" {
40#endif
41
42#define POLARSSL_ERR_THREADING_FEATURE_UNAVAILABLE -0x001A
43#define POLARSSL_ERR_THREADING_BAD_INPUT_DATA -0x001C
44#define POLARSSL_ERR_THREADING_MUTEX_ERROR -0x001E
46#if defined(POLARSSL_THREADING_PTHREAD)
47#include <pthread.h>
48typedef 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
66int 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 */
77extern int (*polarssl_mutex_init)( threading_mutex_t *mutex );
78extern int (*polarssl_mutex_free)( threading_mutex_t *mutex );
79extern int (*polarssl_mutex_lock)( threading_mutex_t *mutex );
80extern int (*polarssl_mutex_unlock)( threading_mutex_t *mutex );
81
82#ifdef __cplusplus
83}
84#endif
85
86#endif /* threading.h */
Configuration options (set of defines)
int(* polarssl_mutex_init)(threading_mutex_t *mutex)
int(* polarssl_mutex_free)(threading_mutex_t *mutex)
int(* polarssl_mutex_unlock)(threading_mutex_t *mutex)
int(* polarssl_mutex_lock)(threading_mutex_t *mutex)