From 50ec02d5320d3cde101ad46844f3bec7304eda35 Mon Sep 17 00:00:00 2001 From: Garrett D'Amore Date: Sun, 5 Jan 2025 08:43:00 -0800 Subject: pthreads: avoid double indirection for cv mutex --- src/platform/posix/posix_thread.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/platform/posix/posix_thread.c') diff --git a/src/platform/posix/posix_thread.c b/src/platform/posix/posix_thread.c index 5238d624..e8c9036c 100644 --- a/src/platform/posix/posix_thread.c +++ b/src/platform/posix/posix_thread.c @@ -1,5 +1,5 @@ // -// Copyright 2024 Staysail Systems, Inc. +// Copyright 2025 Staysail Systems, Inc. // Copyright 2018 Capitar IT Group BV // // This software is supplied under the terms of the MIT License, a @@ -211,7 +211,7 @@ nni_plat_cv_init(nni_plat_cv *cv, nni_plat_mtx *mtx) while (pthread_cond_init(&cv->cv, &nni_cvattr) != 0) { nni_msleep(10); } - cv->mtx = mtx; + cv->mtx = &mtx->mtx; } void @@ -229,7 +229,7 @@ nni_plat_cv_wake1(nni_plat_cv *cv) void nni_plat_cv_wait(nni_plat_cv *cv) { - nni_pthread_cond_wait(&cv->cv, &cv->mtx->mtx); + nni_pthread_cond_wait(&cv->cv, cv->mtx); } int @@ -241,7 +241,7 @@ nni_plat_cv_until(nni_plat_cv *cv, nni_time until) ts.tv_sec = until / 1000; ts.tv_nsec = (until % 1000) * 1000000; - return (nni_pthread_cond_timedwait(&cv->cv, &cv->mtx->mtx, &ts)); + return (nni_pthread_cond_timedwait(&cv->cv, cv->mtx, &ts)); } void -- cgit v1.2.3-70-g09d2