Refactor to help future other implementations
Improve the definition of mbedtls_test_thread_t to assist adding future threading implementations, when they happen. Signed-off-by: Paul Elliott <paul.elliott@arm.com>
This commit is contained in:
parent
0c847bcbe7
commit
24e9a32c83
1 changed files with 16 additions and 8 deletions
|
@ -27,11 +27,6 @@
|
||||||
|
|
||||||
#if defined(MBEDTLS_THREADING_PTHREAD)
|
#if defined(MBEDTLS_THREADING_PTHREAD)
|
||||||
#include <pthread.h>
|
#include <pthread.h>
|
||||||
|
|
||||||
typedef struct mbedtls_test_thread_t {
|
|
||||||
pthread_t MBEDTLS_PRIVATE(thread);
|
|
||||||
} mbedtls_test_thread_t;
|
|
||||||
|
|
||||||
#endif /* MBEDTLS_THREADING_PTHREAD */
|
#endif /* MBEDTLS_THREADING_PTHREAD */
|
||||||
|
|
||||||
#if defined(MBEDTLS_THREADING_ALT)
|
#if defined(MBEDTLS_THREADING_ALT)
|
||||||
|
@ -58,17 +53,30 @@ void mbedtls_test_thread_set_alt(int (*thread_create)(mbedtls_test_thread_t *thr
|
||||||
void *thread_data),
|
void *thread_data),
|
||||||
int (*thread_join)(mbedtls_test_thread_t *thread));
|
int (*thread_join)(mbedtls_test_thread_t *thread));
|
||||||
|
|
||||||
|
#else /* MBEDTLS_THREADING_ALT*/
|
||||||
|
|
||||||
|
typedef struct mbedtls_test_thread_t {
|
||||||
|
|
||||||
|
#if defined(MBEDTLS_THREADING_PTHREAD)
|
||||||
|
pthread_t MBEDTLS_PRIVATE(thread);
|
||||||
|
#else /* MBEDTLS_THREADING_PTHREAD */
|
||||||
|
/* Make sure this struct is always non-empty */
|
||||||
|
unsigned dummy;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
} mbedtls_test_thread_t;
|
||||||
|
|
||||||
#endif /* MBEDTLS_THREADING_ALT*/
|
#endif /* MBEDTLS_THREADING_ALT*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief The function pointers for thread create and thread
|
* \brief The function pointers for thread create and thread
|
||||||
* join.
|
* join.
|
||||||
*
|
*
|
||||||
* \note These functions are part of the testing API only and
|
* \note These functions are part of the testing API only and
|
||||||
* thus not considered part of the public API of
|
* thus not considered part of the public API of
|
||||||
* MbedTLS and thus may change without notice.
|
* MbedTLS and thus may change without notice.
|
||||||
*
|
*
|
||||||
* \note All these functions are expected to work or
|
* \note All these functions are expected to work or
|
||||||
* the result will be undefined.
|
* the result will be undefined.
|
||||||
*/
|
*/
|
||||||
extern int (*mbedtls_test_thread_create)(mbedtls_test_thread_t *thread,
|
extern int (*mbedtls_test_thread_create)(mbedtls_test_thread_t *thread,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue