Allow use of global mutexes with threading_alt
This commit is contained in:
parent
f7c2eebfcf
commit
944cfe8899
4 changed files with 46 additions and 21 deletions
|
@ -55,7 +55,11 @@ typedef struct
|
|||
|
||||
/**
|
||||
* \brief Set your alternate threading implementation function
|
||||
* pointers
|
||||
* pointers and initialize global mutexes. If used, this
|
||||
* function must be called once in the main thread before any
|
||||
* other mbed TLS function is called, and
|
||||
* mbedtls_threading_free_alt() must be called once in the main
|
||||
* thread after all other mbed TLS functions.
|
||||
*
|
||||
* \note mutex_init() and mutex_free() don't return a status code.
|
||||
* If mutex_init() fails, it should leave its argument (the
|
||||
|
@ -66,13 +70,16 @@ typedef struct
|
|||
* \param mutex_free the free function implementation
|
||||
* \param mutex_lock the lock function implementation
|
||||
* \param mutex_unlock the unlock function implementation
|
||||
*
|
||||
* \return 0 if successful
|
||||
*/
|
||||
int mbedtls_threading_set_alt( void (*mutex_init)( mbedtls_threading_mutex_t * ),
|
||||
void mbedtls_threading_set_alt( void (*mutex_init)( mbedtls_threading_mutex_t * ),
|
||||
void (*mutex_free)( mbedtls_threading_mutex_t * ),
|
||||
int (*mutex_lock)( mbedtls_threading_mutex_t * ),
|
||||
int (*mutex_unlock)( mbedtls_threading_mutex_t * ) );
|
||||
|
||||
/**
|
||||
* \brief Free global mutexes.
|
||||
*/
|
||||
void mbedtls_threading_free_alt( void );
|
||||
#endif /* MBEDTLS_THREADING_ALT */
|
||||
|
||||
/*
|
||||
|
@ -85,6 +92,11 @@ extern void (*mbedtls_mutex_free)( mbedtls_threading_mutex_t *mutex );
|
|||
extern int (*mbedtls_mutex_lock)( mbedtls_threading_mutex_t *mutex );
|
||||
extern int (*mbedtls_mutex_unlock)( mbedtls_threading_mutex_t *mutex );
|
||||
|
||||
/*
|
||||
* Global mutexes
|
||||
*/
|
||||
extern mbedtls_threading_mutex_t mbedtls_threading_readdir_mutex;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue