Use gmtime when target is not windows or posix
This commit is contained in:
parent
b363382ba4
commit
ce6eebb0b8
3 changed files with 49 additions and 1 deletions
|
@ -29,6 +29,14 @@
|
|||
|
||||
#include "mbedtls/threading.h"
|
||||
|
||||
#if !defined(_WIN32) && (defined(__unix__) || \
|
||||
(defined(__APPLE__) && defined(__MACH__)))
|
||||
#include <unistd.h>
|
||||
#if !defined(_POSIX_VERSION)
|
||||
#define MBEDTLS_THREADING_USE_GMTIME
|
||||
#endif /* !_POSIX_VERSION */
|
||||
#endif /* !_WIN32 && (__unix__ || (__APPLE__ && __MACH__)) */
|
||||
|
||||
#if defined(MBEDTLS_THREADING_PTHREAD)
|
||||
static void threading_mutex_init_pthread( mbedtls_threading_mutex_t *mutex )
|
||||
{
|
||||
|
@ -114,6 +122,9 @@ void mbedtls_threading_set_alt( void (*mutex_init)( mbedtls_threading_mutex_t *
|
|||
#if defined(MBEDTLS_FS_IO)
|
||||
mbedtls_mutex_init( &mbedtls_threading_readdir_mutex );
|
||||
#endif
|
||||
#if defined(MBEDTLS_THREADING_USE_GMTIME)
|
||||
mbedtls_mutex_init( &mbedtls_threading_gmtime_mutex );
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -124,6 +135,9 @@ void mbedtls_threading_free_alt( void )
|
|||
#if defined(MBEDTLS_FS_IO)
|
||||
mbedtls_mutex_free( &mbedtls_threading_readdir_mutex );
|
||||
#endif
|
||||
#if defined(MBEDTLS_THREADING_USE_GMTIME)
|
||||
mbedtls_mutex_free( &mbedtls_threading_gmtime_mutex );
|
||||
#endif
|
||||
}
|
||||
#endif /* MBEDTLS_THREADING_ALT */
|
||||
|
||||
|
@ -136,5 +150,8 @@ void mbedtls_threading_free_alt( void )
|
|||
#if defined(MBEDTLS_FS_IO)
|
||||
mbedtls_threading_mutex_t mbedtls_threading_readdir_mutex MUTEX_INIT;
|
||||
#endif
|
||||
#if defined(MBEDTLS_THREADING_USE_GMTIME)
|
||||
mbedtls_threading_mutex_t mbedtls_threading_gmtime_mutex MUTEX_INIT;
|
||||
#endif
|
||||
|
||||
#endif /* MBEDTLS_THREADING_C */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue