mirror of
https://sourceware.org/git/glibc.git
synced 2025-01-05 09:01:07 +00:00
Update.
* sysdeps/pthread/pthread_rwlock_rdlock.c: Likewise. * sysdeps/pthread/pthread_rwlock_timedrdlock.c: Likewise. * sysdeps/pthread/pthread_rwlock_timedwrlock.c: Likewise. * sysdeps/pthread/pthread_rwlock_unlock.c: Likewise. * sysdeps/pthread/pthread_rwlock_wrlock.c: Likewise.
This commit is contained in:
parent
3724f268b1
commit
18a535792b
@ -11,6 +11,11 @@
|
|||||||
Likewise.
|
Likewise.
|
||||||
* sysdeps/unix/sysv/linux/i386/i486/pthread_rwlock_unlock.S: Likewise.
|
* sysdeps/unix/sysv/linux/i386/i486/pthread_rwlock_unlock.S: Likewise.
|
||||||
* sysdeps/unix/sysv/linux/i386/i486/pthread_rwlock_wrlock.S: Likewise.
|
* sysdeps/unix/sysv/linux/i386/i486/pthread_rwlock_wrlock.S: Likewise.
|
||||||
|
* sysdeps/pthread/pthread_rwlock_rdlock.c: Likewise.
|
||||||
|
* sysdeps/pthread/pthread_rwlock_timedrdlock.c: Likewise.
|
||||||
|
* sysdeps/pthread/pthread_rwlock_timedwrlock.c: Likewise.
|
||||||
|
* sysdeps/pthread/pthread_rwlock_unlock.c: Likewise.
|
||||||
|
* sysdeps/pthread/pthread_rwlock_wrlock.c: Likewise.
|
||||||
|
|
||||||
2003-02-23 Roland McGrath <roland@redhat.com>
|
2003-02-23 Roland McGrath <roland@redhat.com>
|
||||||
|
|
||||||
|
@ -42,13 +42,12 @@ pthread_rwlock_rdlock(pthread_rwlock_t *rwlock)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
rwlock->nr_readers_queued++;
|
rwlock->nr_readers_queued++;
|
||||||
|
val = rwlock->readers_wakeup;
|
||||||
lll_unlock(rwlock->lock);
|
lll_unlock(rwlock->lock);
|
||||||
|
|
||||||
futex_wait(&rwlock->readers_wakeup, 0)
|
futex_wait(&rwlock->readers_wakeup, val)
|
||||||
|
|
||||||
lll_lock(rwlock->lock);
|
lll_lock(rwlock->lock);
|
||||||
if (!--rwlock->nr_readers_queued)
|
|
||||||
rwlock->readers_wakeup = 0;
|
|
||||||
}
|
}
|
||||||
rwlock->readers++;
|
rwlock->readers++;
|
||||||
lll_unlock(rwlock->lock);
|
lll_unlock(rwlock->lock);
|
||||||
@ -73,13 +72,13 @@ pthread_rwlock_wrlock(pthread_rwlock_t *rwlock)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
rwlock->nr_writers_queued++;
|
rwlock->nr_writers_queued++;
|
||||||
|
val = rwlock->writer_wakeup;
|
||||||
lll_unlock(rwlock->lock);
|
lll_unlock(rwlock->lock);
|
||||||
|
|
||||||
futex_wait(&rwlock->writer_wakeup, 0);
|
futex_wait(&rwlock->writer_wakeup, val);
|
||||||
|
|
||||||
lll_lock(rwlock->lock);
|
lll_lock(rwlock->lock);
|
||||||
rwlock->nr_writers_queued--;
|
rwlock->nr_writers_queued--;
|
||||||
rwlock->writer_wakeup = 0;
|
|
||||||
}
|
}
|
||||||
rwlock->writer = pthread_self();
|
rwlock->writer = pthread_self();
|
||||||
lll_unlock(rwlock->lock);
|
lll_unlock(rwlock->lock);
|
||||||
@ -96,11 +95,11 @@ pthread_rwlock_unlock(pthread_rwlock_t *rwlock)
|
|||||||
|
|
||||||
if (!rwlock->readers) {
|
if (!rwlock->readers) {
|
||||||
if (rwlock->nr_writers_queued) {
|
if (rwlock->nr_writers_queued) {
|
||||||
rwlock->writer_wakeup = 1;
|
++rwlock->writer_wakeup;
|
||||||
futex_wake(&rwlock->writer_wakeup, 1);
|
futex_wake(&rwlock->writer_wakeup, 1);
|
||||||
} else
|
} else
|
||||||
if (rwlock->nr_readers_queued) {
|
if (rwlock->nr_readers_queued) {
|
||||||
rwlock->readers_wakeup = 1;
|
++rwlock->readers_wakeup;
|
||||||
futex_wake(&rwlock->readers_wakeup, MAX_INT);
|
futex_wake(&rwlock->readers_wakeup, MAX_INT);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -72,18 +72,16 @@ __pthread_rwlock_rdlock (rwlock)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int waitval = rwlock->__data.__readers_wakeup;
|
||||||
|
|
||||||
/* Free the lock. */
|
/* Free the lock. */
|
||||||
lll_mutex_unlock (rwlock->__data.__lock);
|
lll_mutex_unlock (rwlock->__data.__lock);
|
||||||
|
|
||||||
/* Wait for the writer to finish. */
|
/* Wait for the writer to finish. */
|
||||||
lll_futex_wait (&rwlock->__data.__readers_wakeup, 0);
|
lll_futex_wait (&rwlock->__data.__readers_wakeup, waitval);
|
||||||
|
|
||||||
/* Get the lock. */
|
/* Get the lock. */
|
||||||
lll_mutex_lock (rwlock->__data.__lock);
|
lll_mutex_lock (rwlock->__data.__lock);
|
||||||
|
|
||||||
/* To start over again, remove the thread from the reader list. */
|
|
||||||
if (--rwlock->__data.__nr_readers_queued == 0)
|
|
||||||
rwlock->__data.__readers_wakeup = 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* We are done, free the lock. */
|
/* We are done, free the lock. */
|
||||||
|
@ -105,19 +105,18 @@ pthread_rwlock_timedrdlock (rwlock, abstime)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int waitval = rwlock->__data.__readers_wakeup;
|
||||||
|
|
||||||
/* Free the lock. */
|
/* Free the lock. */
|
||||||
lll_mutex_unlock (rwlock->__data.__lock);
|
lll_mutex_unlock (rwlock->__data.__lock);
|
||||||
|
|
||||||
/* Wait for the writer to finish. */
|
/* Wait for the writer to finish. */
|
||||||
result = lll_futex_timed_wait (&rwlock->__data.__readers_wakeup, 0, &rt);
|
result = lll_futex_timed_wait (&rwlock->__data.__readers_wakeup,
|
||||||
|
waitval, &rt);
|
||||||
|
|
||||||
/* Get the lock. */
|
/* Get the lock. */
|
||||||
lll_mutex_lock (rwlock->__data.__lock);
|
lll_mutex_lock (rwlock->__data.__lock);
|
||||||
|
|
||||||
/* To start over again, remove the thread from the reader list. */
|
|
||||||
if (--rwlock->__data.__nr_readers_queued == 0)
|
|
||||||
rwlock->__data.__readers_wakeup = 0;
|
|
||||||
|
|
||||||
/* Did the futex call time out? */
|
/* Did the futex call time out? */
|
||||||
if (result == -ETIMEDOUT)
|
if (result == -ETIMEDOUT)
|
||||||
{
|
{
|
||||||
|
@ -95,18 +95,20 @@ pthread_rwlock_timedwrlock (rwlock, abstime)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int waitval = rwlock->__data.__writer_wakeup;
|
||||||
|
|
||||||
/* Free the lock. */
|
/* Free the lock. */
|
||||||
lll_mutex_unlock (rwlock->__data.__lock);
|
lll_mutex_unlock (rwlock->__data.__lock);
|
||||||
|
|
||||||
/* Wait for the writer or reader(s) to finish. */
|
/* Wait for the writer or reader(s) to finish. */
|
||||||
result = lll_futex_timed_wait (&rwlock->__data.__writer_wakeup, 0, &rt);
|
result = lll_futex_timed_wait (&rwlock->__data.__writer_wakeup,
|
||||||
|
waitval, &rt);
|
||||||
|
|
||||||
/* Get the lock. */
|
/* Get the lock. */
|
||||||
lll_mutex_lock (rwlock->__data.__lock);
|
lll_mutex_lock (rwlock->__data.__lock);
|
||||||
|
|
||||||
/* To start over again, remove the thread from the writer list. */
|
/* To start over again, remove the thread from the writer list. */
|
||||||
--rwlock->__data.__nr_writers_queued;
|
--rwlock->__data.__nr_writers_queued;
|
||||||
rwlock->__data.__writer_wakeup = 0;
|
|
||||||
|
|
||||||
/* Did the futex call time out? */
|
/* Did the futex call time out? */
|
||||||
if (result == -ETIMEDOUT)
|
if (result == -ETIMEDOUT)
|
||||||
|
@ -35,12 +35,12 @@ int __pthread_rwlock_unlock (pthread_rwlock_t *rwlock)
|
|||||||
{
|
{
|
||||||
if (rwlock->__data.__nr_writers_queued)
|
if (rwlock->__data.__nr_writers_queued)
|
||||||
{
|
{
|
||||||
rwlock->__data.__writer_wakeup = 1;
|
++rwlock->__data.__writer_wakeup;
|
||||||
lll_futex_wake(&rwlock->__data.__writer_wakeup, 1);
|
lll_futex_wake(&rwlock->__data.__writer_wakeup, 1);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
rwlock->__data.__readers_wakeup = 1;
|
++rwlock->__data.__readers_wakeup;
|
||||||
lll_futex_wake(&rwlock->__data.__readers_wakeup, INT_MAX);
|
lll_futex_wake(&rwlock->__data.__readers_wakeup, INT_MAX);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -63,18 +63,19 @@ __pthread_rwlock_wrlock (rwlock)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int waitval = rwlock->__data.__writer_wakeup;
|
||||||
|
|
||||||
/* Free the lock. */
|
/* Free the lock. */
|
||||||
lll_mutex_unlock (rwlock->__data.__lock);
|
lll_mutex_unlock (rwlock->__data.__lock);
|
||||||
|
|
||||||
/* Wait for the writer or reader(s) to finish. */
|
/* Wait for the writer or reader(s) to finish. */
|
||||||
lll_futex_wait (&rwlock->__data.__writer_wakeup, 0);
|
lll_futex_wait (&rwlock->__data.__writer_wakeup, waitval);
|
||||||
|
|
||||||
/* Get the lock. */
|
/* Get the lock. */
|
||||||
lll_mutex_lock (rwlock->__data.__lock);
|
lll_mutex_lock (rwlock->__data.__lock);
|
||||||
|
|
||||||
/* To start over again, remove the thread from the writer list. */
|
/* To start over again, remove the thread from the writer list. */
|
||||||
--rwlock->__data.__nr_writers_queued;
|
--rwlock->__data.__nr_writers_queued;
|
||||||
rwlock->__data.__writer_wakeup = 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* We are done, free the lock. */
|
/* We are done, free the lock. */
|
||||||
|
@ -45,7 +45,6 @@ __pthread_rwlock_rdlock:
|
|||||||
pushl %ebx
|
pushl %ebx
|
||||||
|
|
||||||
xorl %esi, %esi
|
xorl %esi, %esi
|
||||||
xorl %edx, %edx
|
|
||||||
movl 12(%esp), %ebx
|
movl 12(%esp), %ebx
|
||||||
|
|
||||||
/* Get the lock. */
|
/* Get the lock. */
|
||||||
@ -70,6 +69,8 @@ __pthread_rwlock_rdlock:
|
|||||||
3: incl READERS_QUEUED(%ebx)
|
3: incl READERS_QUEUED(%ebx)
|
||||||
je 4f
|
je 4f
|
||||||
|
|
||||||
|
movl READERS_WAKEUP(%ebx), %edx
|
||||||
|
|
||||||
LOCK
|
LOCK
|
||||||
#if MUTEX == 0
|
#if MUTEX == 0
|
||||||
decl (%ebx)
|
decl (%ebx)
|
||||||
@ -97,8 +98,6 @@ __pthread_rwlock_rdlock:
|
|||||||
jne 12f
|
jne 12f
|
||||||
|
|
||||||
13: decl READERS_QUEUED(%ebx)
|
13: decl READERS_QUEUED(%ebx)
|
||||||
jne 2b
|
|
||||||
movl $0, READERS_WAKEUP(%ebx)
|
|
||||||
jmp 2b
|
jmp 2b
|
||||||
|
|
||||||
5: xorl %ecx, %ecx
|
5: xorl %ecx, %ecx
|
||||||
@ -118,7 +117,12 @@ __pthread_rwlock_rdlock:
|
|||||||
popl %esi
|
popl %esi
|
||||||
ret
|
ret
|
||||||
|
|
||||||
1: movl %ebx, %ecx
|
1:
|
||||||
|
#if MUTEX == 0
|
||||||
|
movl %ebx, %ecx
|
||||||
|
#else
|
||||||
|
leal MUTEX(%ebx), %ecx
|
||||||
|
#endif
|
||||||
call __lll_mutex_lock_wait
|
call __lll_mutex_lock_wait
|
||||||
jmp 2b
|
jmp 2b
|
||||||
|
|
||||||
@ -128,7 +132,12 @@ __pthread_rwlock_rdlock:
|
|||||||
movl $EDEADLK, %ecx
|
movl $EDEADLK, %ecx
|
||||||
jmp 9b
|
jmp 9b
|
||||||
|
|
||||||
6: movl %ebx, %eax
|
6:
|
||||||
|
#if MUTEX == 0
|
||||||
|
movl %ebx, %eax
|
||||||
|
#else
|
||||||
|
leal MUTEX(%ebx), %eax
|
||||||
|
#endif
|
||||||
call __lll_mutex_unlock_wake
|
call __lll_mutex_unlock_wake
|
||||||
jmp 7b
|
jmp 7b
|
||||||
|
|
||||||
@ -142,11 +151,21 @@ __pthread_rwlock_rdlock:
|
|||||||
movl $EAGAIN, %ecx
|
movl $EAGAIN, %ecx
|
||||||
jmp 9b
|
jmp 9b
|
||||||
|
|
||||||
10: movl %ebx, %eax
|
10:
|
||||||
|
#if MUTEX == 0
|
||||||
|
movl %ebx, %eax
|
||||||
|
#else
|
||||||
|
leal MUTEX(%ebx), %eax
|
||||||
|
#endif
|
||||||
call __lll_mutex_unlock_wake
|
call __lll_mutex_unlock_wake
|
||||||
jmp 11b
|
jmp 11b
|
||||||
|
|
||||||
12: movl %ebx, %ecx
|
12:
|
||||||
|
#if MUTEX == 0
|
||||||
|
movl %ebx, %ecx
|
||||||
|
#else
|
||||||
|
leal MUTEX(%ebx), %ecx
|
||||||
|
#endif
|
||||||
call __lll_mutex_lock_wait
|
call __lll_mutex_lock_wait
|
||||||
jmp 13b
|
jmp 13b
|
||||||
.size __pthread_rwlock_rdlock,.-__pthread_rwlock_rdlock
|
.size __pthread_rwlock_rdlock,.-__pthread_rwlock_rdlock
|
||||||
|
@ -79,6 +79,8 @@ pthread_rwlock_timedrdlock:
|
|||||||
incl READERS_QUEUED(%ebp)
|
incl READERS_QUEUED(%ebp)
|
||||||
je 4f
|
je 4f
|
||||||
|
|
||||||
|
movl READERS_WAKEUP(%ebp), %esi
|
||||||
|
|
||||||
LOCK
|
LOCK
|
||||||
#if MUTEX == 0
|
#if MUTEX == 0
|
||||||
decl (%ebp)
|
decl (%ebp)
|
||||||
@ -110,9 +112,9 @@ pthread_rwlock_timedrdlock:
|
|||||||
/* Futex call. */
|
/* Futex call. */
|
||||||
movl %ecx, (%esp) /* Store relative timeout. */
|
movl %ecx, (%esp) /* Store relative timeout. */
|
||||||
movl %edx, 4(%esp)
|
movl %edx, 4(%esp)
|
||||||
|
movl %esi, %edx
|
||||||
xorl %ecx, %ecx /* movl $FUTEX_WAIT, %ecx */
|
xorl %ecx, %ecx /* movl $FUTEX_WAIT, %ecx */
|
||||||
movl %esp, %esi
|
movl %esp, %esi
|
||||||
movl %ecx, %edx
|
|
||||||
leal READERS_WAKEUP(%ebp), %ebx
|
leal READERS_WAKEUP(%ebp), %ebx
|
||||||
movl $SYS_futex, %eax
|
movl $SYS_futex, %eax
|
||||||
ENTER_KERNEL
|
ENTER_KERNEL
|
||||||
@ -130,12 +132,12 @@ pthread_rwlock_timedrdlock:
|
|||||||
testl %eax, %eax
|
testl %eax, %eax
|
||||||
jne 12f
|
jne 12f
|
||||||
|
|
||||||
13: cmpl $-ETIMEDOUT, %ecx
|
13: decl READERS_QUEUED(%ebp)
|
||||||
je 18f
|
cmpl $-ETIMEDOUT, %edx
|
||||||
decl READERS_QUEUED(%ebp)
|
|
||||||
jne 2b
|
jne 2b
|
||||||
movl $0, READERS_WAKEUP(%ebp)
|
|
||||||
jmp 2b
|
18: movl $ETIMEDOUT, %ecx
|
||||||
|
jmp 9f
|
||||||
|
|
||||||
|
|
||||||
5: xorl %ecx, %ecx
|
5: xorl %ecx, %ecx
|
||||||
@ -158,7 +160,12 @@ pthread_rwlock_timedrdlock:
|
|||||||
popl %esi
|
popl %esi
|
||||||
ret
|
ret
|
||||||
|
|
||||||
1: movl %ebp, %ecx
|
1:
|
||||||
|
#if MUTEX == 0
|
||||||
|
movl %ebp, %ecx
|
||||||
|
#else
|
||||||
|
leal MUTEX(%ebp), %ecx
|
||||||
|
#endif
|
||||||
call __lll_mutex_lock_wait
|
call __lll_mutex_lock_wait
|
||||||
jmp 2b
|
jmp 2b
|
||||||
|
|
||||||
@ -167,7 +174,12 @@ pthread_rwlock_timedrdlock:
|
|||||||
movl $EDEADLK, %ecx
|
movl $EDEADLK, %ecx
|
||||||
jmp 9b
|
jmp 9b
|
||||||
|
|
||||||
6: movl %ebp, %eax
|
6:
|
||||||
|
#if MUTEX == 0
|
||||||
|
movl %ebp, %eax
|
||||||
|
#else
|
||||||
|
leal MUTEX(%ebp), %eax
|
||||||
|
#endif
|
||||||
call __lll_mutex_unlock_wake
|
call __lll_mutex_unlock_wake
|
||||||
jmp 7b
|
jmp 7b
|
||||||
|
|
||||||
@ -181,20 +193,27 @@ pthread_rwlock_timedrdlock:
|
|||||||
movl $EAGAIN, %ecx
|
movl $EAGAIN, %ecx
|
||||||
jmp 9b
|
jmp 9b
|
||||||
|
|
||||||
10: movl %ebp, %eax
|
10:
|
||||||
|
#if MUTEX == 0
|
||||||
|
movl %ebp, %eax
|
||||||
|
#else
|
||||||
|
leal MUTEX(%ebp), %eax
|
||||||
|
#endif
|
||||||
call __lll_mutex_unlock_wake
|
call __lll_mutex_unlock_wake
|
||||||
jmp 11b
|
jmp 11b
|
||||||
|
|
||||||
12: movl %ebx, %ecx
|
12:
|
||||||
|
#if MUTEX == 0
|
||||||
|
movl %ebp, %ecx
|
||||||
|
#else
|
||||||
|
leal MUTEX(%ebp), %ecx
|
||||||
|
#endif
|
||||||
call __lll_mutex_lock_wait
|
call __lll_mutex_lock_wait
|
||||||
jmp 13b
|
jmp 13b
|
||||||
|
|
||||||
16: movl $-ETIMEDOUT, %ecx
|
16: movl $-ETIMEDOUT, %edx
|
||||||
jmp 17b
|
jmp 17b
|
||||||
|
|
||||||
18: movl $ETIMEDOUT, %ecx
|
|
||||||
jmp 9b
|
|
||||||
|
|
||||||
19: movl $EINVAL, %ecx
|
19: movl $EINVAL, %ecx
|
||||||
jmp 9b
|
jmp 9b
|
||||||
.size pthread_rwlock_timedrdlock,.-pthread_rwlock_timedrdlock
|
.size pthread_rwlock_timedrdlock,.-pthread_rwlock_timedrdlock
|
||||||
|
@ -77,6 +77,8 @@ pthread_rwlock_timedwrlock:
|
|||||||
incl WRITERS_QUEUED(%ebp)
|
incl WRITERS_QUEUED(%ebp)
|
||||||
je 4f
|
je 4f
|
||||||
|
|
||||||
|
movl WRITERS_WAKEUP(%ebp), %esi
|
||||||
|
|
||||||
LOCK
|
LOCK
|
||||||
#if MUTEX == 0
|
#if MUTEX == 0
|
||||||
decl (%ebp)
|
decl (%ebp)
|
||||||
@ -108,9 +110,9 @@ pthread_rwlock_timedwrlock:
|
|||||||
/* Futex call. */
|
/* Futex call. */
|
||||||
movl %ecx, (%esp) /* Store relative timeout. */
|
movl %ecx, (%esp) /* Store relative timeout. */
|
||||||
movl %edx, 4(%esp)
|
movl %edx, 4(%esp)
|
||||||
|
movl %esi, %edx
|
||||||
xorl %ecx, %ecx /* movl $FUTEX_WAIT, %ecx */
|
xorl %ecx, %ecx /* movl $FUTEX_WAIT, %ecx */
|
||||||
movl %esp, %esi
|
movl %esp, %esi
|
||||||
movl %ecx, %edx
|
|
||||||
leal WRITERS_WAKEUP(%ebp), %ebx
|
leal WRITERS_WAKEUP(%ebp), %ebx
|
||||||
movl $SYS_futex, %eax
|
movl $SYS_futex, %eax
|
||||||
ENTER_KERNEL
|
ENTER_KERNEL
|
||||||
@ -128,11 +130,12 @@ pthread_rwlock_timedwrlock:
|
|||||||
testl %eax, %eax
|
testl %eax, %eax
|
||||||
jne 12f
|
jne 12f
|
||||||
|
|
||||||
13: cmpl $-ETIMEDOUT, %ecx
|
13: decl WRITERS_QUEUED(%ebp)
|
||||||
je 18f
|
cmpl $-ETIMEDOUT, %edx
|
||||||
decl WRITERS_QUEUED(%ebp)
|
jne 2b
|
||||||
movl $0, WRITERS_WAKEUP(%ebp)
|
|
||||||
jmp 2b
|
18: movl $ETIMEDOUT, %ecx
|
||||||
|
jmp 9f
|
||||||
|
|
||||||
|
|
||||||
5: xorl %ecx, %ecx
|
5: xorl %ecx, %ecx
|
||||||
@ -155,7 +158,12 @@ pthread_rwlock_timedwrlock:
|
|||||||
popl %esi
|
popl %esi
|
||||||
ret
|
ret
|
||||||
|
|
||||||
1: movl %ebp, %ecx
|
1:
|
||||||
|
#if MUTEX == 0
|
||||||
|
movl %ebp, %ecx
|
||||||
|
#else
|
||||||
|
leal MUTEX(%ebp), %ecx
|
||||||
|
#endif
|
||||||
call __lll_mutex_lock_wait
|
call __lll_mutex_lock_wait
|
||||||
jmp 2b
|
jmp 2b
|
||||||
|
|
||||||
@ -164,7 +172,12 @@ pthread_rwlock_timedwrlock:
|
|||||||
20: movl $EDEADLK, %ecx
|
20: movl $EDEADLK, %ecx
|
||||||
jmp 9b
|
jmp 9b
|
||||||
|
|
||||||
6: movl %ebp, %eax
|
6:
|
||||||
|
#if MUTEX == 0
|
||||||
|
movl %ebp, %eax
|
||||||
|
#else
|
||||||
|
leal MUTEX(%ebp), %eax
|
||||||
|
#endif
|
||||||
call __lll_mutex_unlock_wake
|
call __lll_mutex_unlock_wake
|
||||||
jmp 7b
|
jmp 7b
|
||||||
|
|
||||||
@ -173,20 +186,27 @@ pthread_rwlock_timedwrlock:
|
|||||||
movl $EAGAIN, %ecx
|
movl $EAGAIN, %ecx
|
||||||
jmp 9b
|
jmp 9b
|
||||||
|
|
||||||
10: movl %ebp, %eax
|
10:
|
||||||
|
#if MUTEX == 0
|
||||||
|
movl %ebp, %eax
|
||||||
|
#else
|
||||||
|
leal MUTEX(%ebp), %eax
|
||||||
|
#endif
|
||||||
call __lll_mutex_unlock_wake
|
call __lll_mutex_unlock_wake
|
||||||
jmp 11b
|
jmp 11b
|
||||||
|
|
||||||
12: movl %ebx, %ecx
|
12:
|
||||||
|
#if MUTEX == 0
|
||||||
|
movl %ebp, %ecx
|
||||||
|
#else
|
||||||
|
leal MUTEX(%ebp), %ecx
|
||||||
|
#endif
|
||||||
call __lll_mutex_lock_wait
|
call __lll_mutex_lock_wait
|
||||||
jmp 13b
|
jmp 13b
|
||||||
|
|
||||||
16: movl $-ETIMEDOUT, %ecx
|
16: movl $-ETIMEDOUT, %edx
|
||||||
jmp 17b
|
jmp 17b
|
||||||
|
|
||||||
18: movl $ETIMEDOUT, %ecx
|
|
||||||
jmp 9b
|
|
||||||
|
|
||||||
19: movl $EINVAL, %ecx
|
19: movl $EINVAL, %ecx
|
||||||
jmp 9b
|
jmp 9b
|
||||||
.size pthread_rwlock_timedwrlock,.-pthread_rwlock_timedwrlock
|
.size pthread_rwlock_timedwrlock,.-pthread_rwlock_timedwrlock
|
||||||
|
@ -42,8 +42,6 @@ __pthread_rwlock_unlock:
|
|||||||
pushl %esi
|
pushl %esi
|
||||||
pushl %edi
|
pushl %edi
|
||||||
|
|
||||||
xorl %esi, %esi
|
|
||||||
xorl %edx, %edx
|
|
||||||
movl 16(%esp), %edi
|
movl 16(%esp), %edi
|
||||||
|
|
||||||
/* Get the lock. */
|
/* Get the lock. */
|
||||||
@ -64,20 +62,21 @@ __pthread_rwlock_unlock:
|
|||||||
|
|
||||||
5: movl $0, WRITER(%edi)
|
5: movl $0, WRITER(%edi)
|
||||||
|
|
||||||
|
movl $1, %ecx
|
||||||
|
leal WRITERS_WAKEUP(%edi), %ebx
|
||||||
|
movl %ecx, %edx
|
||||||
|
cmpl $0, WRITERS_QUEUED(%edi)
|
||||||
|
jne 0f
|
||||||
|
|
||||||
|
/* If also no readers waiting nothing to do. */
|
||||||
|
cmpl $0, READERS_QUEUED(%edi)
|
||||||
|
je 6f
|
||||||
|
|
||||||
movl $0x7fffffff, %edx
|
movl $0x7fffffff, %edx
|
||||||
leal READERS_WAKEUP(%edi), %ebx
|
leal READERS_WAKEUP(%edi), %ebx
|
||||||
movl $1, %ecx
|
|
||||||
leal WRITERS_WAKEUP(%edi), %eax
|
0: incl (%ebx)
|
||||||
cmpl $0, WRITERS_QUEUED(%edi)
|
xorl %esi, %esi
|
||||||
#ifdef HAVE_CMOV
|
|
||||||
cmovnel %ecx, %edx
|
|
||||||
cmovnel %eax, %ebx
|
|
||||||
#else
|
|
||||||
je 0f
|
|
||||||
movl %ecx, %edx
|
|
||||||
movl %eax, %ebx
|
|
||||||
0:
|
|
||||||
#endif
|
|
||||||
movl $SYS_futex, %eax
|
movl $SYS_futex, %eax
|
||||||
ENTER_KERNEL
|
ENTER_KERNEL
|
||||||
|
|
||||||
@ -95,11 +94,21 @@ __pthread_rwlock_unlock:
|
|||||||
popl %ebx
|
popl %ebx
|
||||||
ret
|
ret
|
||||||
|
|
||||||
1: movl %edi, %ecx
|
1:
|
||||||
|
#if MUTEX == 0
|
||||||
|
movl %edi, %ecx
|
||||||
|
#else
|
||||||
|
leal MUTEX(%edx), %ecx
|
||||||
|
#endif
|
||||||
call __lll_mutex_lock_wait
|
call __lll_mutex_lock_wait
|
||||||
jmp 2b
|
jmp 2b
|
||||||
|
|
||||||
3: movl %edi, %eax
|
3:
|
||||||
|
#if MUTEX == 0
|
||||||
|
movl %edi, %eax
|
||||||
|
#else
|
||||||
|
leal MUTEX(%edx), %eax
|
||||||
|
#endif
|
||||||
call __lll_mutex_unlock_wake
|
call __lll_mutex_unlock_wake
|
||||||
jmp 4b
|
jmp 4b
|
||||||
|
|
||||||
|
@ -45,7 +45,6 @@ __pthread_rwlock_wrlock:
|
|||||||
pushl %ebx
|
pushl %ebx
|
||||||
|
|
||||||
xorl %esi, %esi
|
xorl %esi, %esi
|
||||||
xorl %edx, %edx
|
|
||||||
movl 12(%esp), %ebx
|
movl 12(%esp), %ebx
|
||||||
|
|
||||||
/* Get the lock. */
|
/* Get the lock. */
|
||||||
@ -68,6 +67,8 @@ __pthread_rwlock_wrlock:
|
|||||||
3: incl WRITERS_QUEUED(%ebx)
|
3: incl WRITERS_QUEUED(%ebx)
|
||||||
je 4f
|
je 4f
|
||||||
|
|
||||||
|
movl WRITERS_WAKEUP(%ebx), %edx
|
||||||
|
|
||||||
LOCK
|
LOCK
|
||||||
#if MUTEX == 0
|
#if MUTEX == 0
|
||||||
decl (%ebx)
|
decl (%ebx)
|
||||||
@ -95,7 +96,6 @@ __pthread_rwlock_wrlock:
|
|||||||
jne 12f
|
jne 12f
|
||||||
|
|
||||||
13: decl WRITERS_QUEUED(%ebx)
|
13: decl WRITERS_QUEUED(%ebx)
|
||||||
movl $0, WRITERS_WAKEUP(%ebx)
|
|
||||||
jmp 2b
|
jmp 2b
|
||||||
|
|
||||||
5: xorl %ecx, %ecx
|
5: xorl %ecx, %ecx
|
||||||
@ -115,7 +115,12 @@ __pthread_rwlock_wrlock:
|
|||||||
popl %esi
|
popl %esi
|
||||||
ret
|
ret
|
||||||
|
|
||||||
1: movl %ebx, %ecx
|
1:
|
||||||
|
#if MUTEX == 0
|
||||||
|
movl %ebx, %ecx
|
||||||
|
#else
|
||||||
|
leal MUTEX(%ebx), %ecx
|
||||||
|
#endif
|
||||||
call __lll_mutex_lock_wait
|
call __lll_mutex_lock_wait
|
||||||
jmp 2b
|
jmp 2b
|
||||||
|
|
||||||
@ -124,7 +129,12 @@ __pthread_rwlock_wrlock:
|
|||||||
movl $EDEADLK, %ecx
|
movl $EDEADLK, %ecx
|
||||||
jmp 9b
|
jmp 9b
|
||||||
|
|
||||||
6: movl %ebx, %eax
|
6:
|
||||||
|
#if MUTEX == 0
|
||||||
|
movl %ebx, %eax
|
||||||
|
#else
|
||||||
|
leal MUTEX(%ebx), %eax
|
||||||
|
#endif
|
||||||
call __lll_mutex_unlock_wake
|
call __lll_mutex_unlock_wake
|
||||||
jmp 7b
|
jmp 7b
|
||||||
|
|
||||||
@ -132,11 +142,21 @@ __pthread_rwlock_wrlock:
|
|||||||
movl $EAGAIN, %ecx
|
movl $EAGAIN, %ecx
|
||||||
jmp 9b
|
jmp 9b
|
||||||
|
|
||||||
10: movl %ebx, %eax
|
10:
|
||||||
|
#if MUTEX == 0
|
||||||
|
movl %ebx, %eax
|
||||||
|
#else
|
||||||
|
leal MUTEX(%ebx), %eax
|
||||||
|
#endif
|
||||||
call __lll_mutex_unlock_wake
|
call __lll_mutex_unlock_wake
|
||||||
jmp 11b
|
jmp 11b
|
||||||
|
|
||||||
12: movl %ebx, %ecx
|
12:
|
||||||
|
#if MUTEX == 0
|
||||||
|
movl %ebx, %ecx
|
||||||
|
#else
|
||||||
|
leal MUTEX(%ebx), %ecx
|
||||||
|
#endif
|
||||||
call __lll_mutex_lock_wait
|
call __lll_mutex_lock_wait
|
||||||
jmp 13b
|
jmp 13b
|
||||||
.size __pthread_rwlock_wrlock,.-__pthread_rwlock_wrlock
|
.size __pthread_rwlock_wrlock,.-__pthread_rwlock_wrlock
|
||||||
|
Loading…
Reference in New Issue
Block a user