aboutsummaryrefslogtreecommitdiff
path: root/src/platform/posix/posix_impl.h
diff options
context:
space:
mode:
authorGarrett D'Amore <garrett@damore.org>2025-01-05 08:43:00 -0800
committerGarrett D'Amore <garrett@damore.org>2025-01-05 09:40:04 -0800
commit50ec02d5320d3cde101ad46844f3bec7304eda35 (patch)
tree80f9eb0f5d714902c5387e2c77f5085042e88e04 /src/platform/posix/posix_impl.h
parentf08a488c30ff102c29f589c138bae29d91dccb2a (diff)
downloadnng-50ec02d5320d3cde101ad46844f3bec7304eda35.tar.gz
nng-50ec02d5320d3cde101ad46844f3bec7304eda35.tar.bz2
nng-50ec02d5320d3cde101ad46844f3bec7304eda35.zip
pthreads: avoid double indirection for cv mutex
Diffstat (limited to 'src/platform/posix/posix_impl.h')
-rw-r--r--src/platform/posix/posix_impl.h10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/platform/posix/posix_impl.h b/src/platform/posix/posix_impl.h
index a0bb3217..4cac6beb 100644
--- a/src/platform/posix/posix_impl.h
+++ b/src/platform/posix/posix_impl.h
@@ -77,16 +77,16 @@ struct nni_rwlock {
// No static form of CV initialization because of the need to use
// attributes to set the clock type.
struct nni_plat_cv {
- pthread_cond_t cv;
- nni_plat_mtx *mtx;
+ pthread_cond_t cv;
+ pthread_mutex_t *mtx;
};
// NOTE: condition variables initialized with this should *NOT*
// be used with nni_cv_until -- the clock attributes are not passed
// and the wake-up times will not be correct.
-#define NNI_CV_INITIALIZER(mxp) \
- { \
- .mtx = mxp, .cv = PTHREAD_COND_INITIALIZER \
+#define NNI_CV_INITIALIZER(mxp) \
+ { \
+ .mtx = &((mxp)->mtx), .cv = PTHREAD_COND_INITIALIZER \
}
struct nni_plat_thr {