From 54bcf3afdd5f1c7a10dbb425f0e31702937658ff Mon Sep 17 00:00:00 2001 From: raiden00pl Date: Wed, 17 May 2023 12:11:22 +0200 Subject: [PATCH] examples/foc/foc_thr: fix mutex logic --- examples/foc/foc_thr.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/examples/foc/foc_thr.c b/examples/foc/foc_thr.c index de5d580e5..83b39ce5a 100644 --- a/examples/foc/foc_thr.c +++ b/examples/foc/foc_thr.c @@ -256,14 +256,14 @@ bool foc_threads_terminated(void) { bool ret = false; - pthread_mutex_unlock(&g_cntr_lock); + pthread_mutex_lock(&g_cntr_lock); if (g_foc_thr == 0) { ret = true; } - pthread_mutex_lock(&g_cntr_lock); + pthread_mutex_unlock(&g_cntr_lock); return ret; } @@ -276,9 +276,9 @@ uint32_t foc_threads_get(void) { uint32_t ret = 0; - pthread_mutex_unlock(&g_cntr_lock); - ret = g_foc_thr; pthread_mutex_lock(&g_cntr_lock); + ret = g_foc_thr; + pthread_mutex_unlock(&g_cntr_lock); return ret; }