mirror of
https://github.com/Mbed-TLS/mbedtls.git
synced 2025-04-16 08:42:50 +00:00
Lock test mutex before doing mutex usage check
Although this again should only happen post all threads stopping, guard this just in case things change. Signed-off-by: Paul Elliott <paul.elliott@arm.com>
This commit is contained in:
parent
114ed5ef1e
commit
ba536dc1db
@ -317,6 +317,7 @@ void mbedtls_test_mutex_usage_init(void)
|
||||
|
||||
void mbedtls_test_mutex_usage_check(void)
|
||||
{
|
||||
if (mutex_functions.lock(&mbedtls_test_mutex_mutex) == 0) {
|
||||
if (live_mutexes != 0) {
|
||||
/* A positive number (more init than free) means that a mutex resource
|
||||
* is leaking (on platforms where a mutex consumes more than the
|
||||
@ -333,6 +334,9 @@ void mbedtls_test_mutex_usage_check(void)
|
||||
mbedtls_test_fail("Mutex usage error", __LINE__, __FILE__);
|
||||
}
|
||||
mbedtls_test_set_mutex_usage_error(NULL);
|
||||
|
||||
mutex_functions.unlock(&mbedtls_test_mutex_mutex);
|
||||
}
|
||||
}
|
||||
|
||||
void mbedtls_test_mutex_usage_end(void)
|
||||
|
Loading…
x
Reference in New Issue
Block a user