summaryrefslogtreecommitdiffstats
path: root/lib/libthr/thread/thr_mutex.c
diff options
context:
space:
mode:
authorjasone <jasone@FreeBSD.org>2007-11-28 00:16:24 +0000
committerjasone <jasone@FreeBSD.org>2007-11-28 00:16:24 +0000
commit600513aa8d26e2661e657d0e1e26eb6cbc9c85e8 (patch)
treebb5fd2cec7b86859a0de3c64cf67b19e6ca6df92 /lib/libthr/thread/thr_mutex.c
parent8ee51043418b2b11413644c7a7057901d8c70caf (diff)
downloadFreeBSD-src-600513aa8d26e2661e657d0e1e26eb6cbc9c85e8.zip
FreeBSD-src-600513aa8d26e2661e657d0e1e26eb6cbc9c85e8.tar.gz
Fix pointer dereferencing problems in _pthread_mutex_init_calloc_cb() that
were obscured by pseudo-opaque pthreads API pointer casting.
Diffstat (limited to 'lib/libthr/thread/thr_mutex.c')
-rw-r--r--lib/libthr/thread/thr_mutex.c10
1 files changed, 3 insertions, 7 deletions
diff --git a/lib/libthr/thread/thr_mutex.c b/lib/libthr/thread/thr_mutex.c
index 35b6352..fc233b6 100644
--- a/lib/libthr/thread/thr_mutex.c
+++ b/lib/libthr/thread/thr_mutex.c
@@ -212,19 +212,15 @@ int
_pthread_mutex_init_calloc_cb(pthread_mutex_t *mutex,
void *(calloc_cb)(size_t, size_t))
{
-/* XXX Enable adaptive locking if similar code is removed from malloc. */
-#if 0
static const struct pthread_mutex_attr attr = {
- .m_type = PTHREAD_MUTEX_ADAPTIVE_NP,
+ .m_type = PTHREAD_MUTEX_NORMAL,
.m_protocol = PTHREAD_PRIO_NONE,
.m_ceiling = 0,
.m_flags = 0
};
+ static const struct pthread_mutex_attr *pattr = &attr;
- return mutex_init(mutex, (pthread_mutexattr_t *)&attr, 0, calloc_cb);
-#else
- return mutex_init(mutex, NULL, 0, calloc_cb);
-#endif
+ return mutex_init(mutex, (pthread_mutexattr_t *)&pattr, 0, calloc_cb);
}
void
OpenPOWER on IntegriCloud