blob: 3c4d44126a570a1df5af2c4e2d462912cd5ed931 [file] [log] [blame]
Paul Elliott17c119a2023-12-08 16:55:03 +00001/**
2 * \file threading_helpers.h
3 *
4 * \brief This file contains the prototypes of helper functions for the purpose
5 * of testing threading.
6 */
7
8/*
9 * Copyright The Mbed TLS Contributors
10 * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
11 */
12
13#ifndef THREADING_HELPERS_H
14#define THREADING_HELPERS_H
15
16#if defined MBEDTLS_THREADING_C
17
18#if defined(MBEDTLS_THREADING_PTHREAD) && defined(MBEDTLS_TEST_HOOKS)
19#define MBEDTLS_TEST_MUTEX_USAGE
20#endif
21
22#if defined(MBEDTLS_TEST_MUTEX_USAGE)
23/**
24 * Activate the mutex usage verification framework. See threading_helpers.c for
25 * information.
26 */
27void mbedtls_test_mutex_usage_init(void);
28
29/**
30 * Deactivate the mutex usage verification framework. See threading_helpers.c
31 * for information.
32 */
33void mbedtls_test_mutex_usage_end(void);
34
35/**
36 * Call this function after executing a test case to check for mutex usage
37 * errors.
38 */
39void mbedtls_test_mutex_usage_check(void);
40#endif /* MBEDTLS_TEST_MUTEX_USAGE */
41
42#endif /* MBEDTLS_THREADING_C */
43
44#endif /* THREADING_HELPERS_H */
45