From a032a6587011cbdac8c2f7e11f15dc4e592bbb55 Mon Sep 17 00:00:00 2001 From: Austin Foxley Date: Tue, 16 Feb 2010 12:27:18 -0800 Subject: mass sync with glibc nptl Signed-off-by: Austin Foxley --- libpthread/nptl/sysdeps/pthread/pthread_rwlock_wrlock.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) (limited to 'libpthread/nptl/sysdeps/pthread/pthread_rwlock_wrlock.c') diff --git a/libpthread/nptl/sysdeps/pthread/pthread_rwlock_wrlock.c b/libpthread/nptl/sysdeps/pthread/pthread_rwlock_wrlock.c index 1b9186fb8..81e6daa56 100644 --- a/libpthread/nptl/sysdeps/pthread/pthread_rwlock_wrlock.c +++ b/libpthread/nptl/sysdeps/pthread/pthread_rwlock_wrlock.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2003 Free Software Foundation, Inc. +/* Copyright (C) 2003, 2007 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Martin Schwidefsky , 2003. @@ -26,12 +26,13 @@ /* Acquire write lock for RWLOCK. */ int -__pthread_rwlock_wrlock (pthread_rwlock_t *rwlock) +__pthread_rwlock_wrlock ( + pthread_rwlock_t *rwlock) { int result = 0; /* Make sure we are along. */ - lll_mutex_lock (rwlock->__data.__lock); + lll_lock (rwlock->__data.__lock, rwlock->__data.__shared); while (1) { @@ -64,20 +65,21 @@ __pthread_rwlock_wrlock (pthread_rwlock_t *rwlock) int waitval = rwlock->__data.__writer_wakeup; /* Free the lock. */ - lll_mutex_unlock (rwlock->__data.__lock); + lll_unlock (rwlock->__data.__lock, rwlock->__data.__shared); /* Wait for the writer or reader(s) to finish. */ - lll_futex_wait (&rwlock->__data.__writer_wakeup, waitval); + lll_futex_wait (&rwlock->__data.__writer_wakeup, waitval, + rwlock->__data.__shared); /* Get the lock. */ - lll_mutex_lock (rwlock->__data.__lock); + lll_lock (rwlock->__data.__lock, rwlock->__data.__shared); /* To start over again, remove the thread from the writer list. */ --rwlock->__data.__nr_writers_queued; } /* We are done, free the lock. */ - lll_mutex_unlock (rwlock->__data.__lock); + lll_unlock (rwlock->__data.__lock, rwlock->__data.__shared); return result; } -- cgit v1.2.3