22#ifndef MBEDTLS_THREADING_H
23#define MBEDTLS_THREADING_H
25#if !defined(MBEDTLS_CONFIG_FILE)
28#include MBEDTLS_CONFIG_FILE
39#define MBEDTLS_ERR_THREADING_FEATURE_UNAVAILABLE -0x001A
41#define MBEDTLS_ERR_THREADING_BAD_INPUT_DATA -0x001C
42#define MBEDTLS_ERR_THREADING_MUTEX_ERROR -0x001E
44#if defined(MBEDTLS_THREADING_PTHREAD)
46typedef struct mbedtls_threading_mutex_t
48 pthread_mutex_t mutex;
50} mbedtls_threading_mutex_t;
53#if defined(MBEDTLS_THREADING_ALT)
55#include "threading_alt.h"
75void mbedtls_threading_set_alt(
void (*mutex_init)( mbedtls_threading_mutex_t * ),
76 void (*mutex_free)( mbedtls_threading_mutex_t * ),
77 int (*mutex_lock)( mbedtls_threading_mutex_t * ),
78 int (*mutex_unlock)( mbedtls_threading_mutex_t * ) );
83void mbedtls_threading_free_alt(
void );
86#if defined(MBEDTLS_THREADING_C)
92extern void (*mbedtls_mutex_init)( mbedtls_threading_mutex_t *mutex );
93extern void (*mbedtls_mutex_free)( mbedtls_threading_mutex_t *mutex );
94extern int (*mbedtls_mutex_lock)( mbedtls_threading_mutex_t *mutex );
95extern int (*mbedtls_mutex_unlock)( mbedtls_threading_mutex_t *mutex );
100#if defined(MBEDTLS_FS_IO)
101extern mbedtls_threading_mutex_t mbedtls_threading_readdir_mutex;
104#if defined(MBEDTLS_HAVE_TIME_DATE) && !defined(MBEDTLS_PLATFORM_GMTIME_R_ALT)
111extern mbedtls_threading_mutex_t mbedtls_threading_gmtime_mutex;
Configuration options (set of defines)