You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@celix.apache.org by pe...@apache.org on 2023/12/01 12:29:30 UTC
(celix) 07/11: [CID 331917]Fix data race in dm_example.
This is an automated email from the ASF dual-hosted git repository.
pengzheng pushed a commit to branch support/2.4
in repository https://gitbox.apache.org/repos/asf/celix.git
commit 45fd86a81f2a9b9d9fc62e4f8b629dc2deb1b064
Author: PengZheng <ho...@gmail.com>
AuthorDate: Thu Nov 23 18:50:23 2023 +0800
[CID 331917]Fix data race in dm_example.
(cherry picked from commit 045dd21248c95c5c397bc6e1dce62f77c0b976bb)
---
examples/celix-examples/dm_example/phase2b/src/phase2b_cmp.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/examples/celix-examples/dm_example/phase2b/src/phase2b_cmp.c b/examples/celix-examples/dm_example/phase2b/src/phase2b_cmp.c
index a7341509..8cac4631 100644
--- a/examples/celix-examples/dm_example/phase2b/src/phase2b_cmp.c
+++ b/examples/celix-examples/dm_example/phase2b/src/phase2b_cmp.c
@@ -111,6 +111,8 @@ static void *phase2b_thread(void *data) {
}
int phase2b_getData(phase2b_cmp_t *cmp, double *data) {
+ celixThreadMutex_lock(&cmp->mutex);
*data = cmp->currentValue;
+ celixThreadMutex_unlock(&cmp->mutex);
return 0;
}