From c06e7ad5a38a42ccdbd8ae23d9069c4344c37b6d Mon Sep 17 00:00:00 2001 From: Garrett D'Amore Date: Sun, 25 Jun 2017 23:05:18 -0700 Subject: Adding mutex lock during fini to prevent false positive data race. --- src/platform/posix/posix_thread.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/platform') diff --git a/src/platform/posix/posix_thread.c b/src/platform/posix/posix_thread.c index 5abeaded..de491c01 100644 --- a/src/platform/posix/posix_thread.c +++ b/src/platform/posix/posix_thread.c @@ -64,6 +64,8 @@ nni_plat_mtx_fini(nni_plat_mtx *mtx) if (!mtx->init) { return; } + pthread_mutex_lock(&mtx->mtx); + pthread_mutex_unlock(&mtx->mtx); if ((rv = pthread_mutex_destroy(&mtx->mtx)) != 0) { nni_panic("pthread_mutex_fini: %s", strerror(rv)); } -- cgit v1.2.3-70-g09d2