diff options
| author | Garrett D'Amore <garrett@damore.org> | 2017-06-25 23:05:18 -0700 |
|---|---|---|
| committer | Garrett D'Amore <garrett@damore.org> | 2017-06-25 23:05:18 -0700 |
| commit | c06e7ad5a38a42ccdbd8ae23d9069c4344c37b6d (patch) | |
| tree | 9fab6eb15bd7b4b244420df25a7bb94731b30d60 /src/platform | |
| parent | 40c7bc3bceff3d2d14ce3e666f8fa6b0914a2acd (diff) | |
| download | nng-c06e7ad5a38a42ccdbd8ae23d9069c4344c37b6d.tar.gz nng-c06e7ad5a38a42ccdbd8ae23d9069c4344c37b6d.tar.bz2 nng-c06e7ad5a38a42ccdbd8ae23d9069c4344c37b6d.zip | |
Adding mutex lock during fini to prevent false positive data race.
Diffstat (limited to 'src/platform')
| -rw-r--r-- | src/platform/posix/posix_thread.c | 2 |
1 files changed, 2 insertions, 0 deletions
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)); } |
