diff --git a/lib/acl_threadsupport/test/acl_threadsupport_test.cpp b/lib/acl_threadsupport/test/acl_threadsupport_test.cpp index 04fc75b7..01f5d6a8 100644 --- a/lib/acl_threadsupport/test/acl_threadsupport_test.cpp +++ b/lib/acl_threadsupport/test/acl_threadsupport_test.cpp @@ -103,7 +103,10 @@ void *test_thread(void *) { break; acl_thread_yield(); } - if (threadtest_state == END_STATE) { + acl_mutex_lock(&mymutex); + const bool is_end_state = (threadtest_state == END_STATE); + acl_mutex_unlock(&mymutex); + if (is_end_state) { return 0; } // CLIENT_STATE