mirror of
https://sourceware.org/git/glibc.git
synced 2025-01-03 08:11:08 +00:00
Update.
2003-03-16 Ulrich Drepper <drepper@redhat.com> * tst-rwlock6.c: Add some more status output.
This commit is contained in:
parent
ad032aee17
commit
51d0678c29
@ -1,3 +1,7 @@
|
||||
2003-03-16 Ulrich Drepper <drepper@redhat.com>
|
||||
|
||||
* tst-rwlock6.c: Add some more status output.
|
||||
|
||||
2003-03-15 Roland McGrath <roland@redhat.com>
|
||||
|
||||
* sysdeps/pthread/configure.in: New file.
|
||||
|
@ -45,6 +45,7 @@
|
||||
pthread_rwlock_timedrdlock:
|
||||
pushq %r12
|
||||
pushq %r13
|
||||
pushq %r14
|
||||
subq $16, %rsp
|
||||
|
||||
movq %rdi, %r12
|
||||
@ -76,14 +77,14 @@ pthread_rwlock_timedrdlock:
|
||||
incl READERS_QUEUED(%r12)
|
||||
je 4f
|
||||
|
||||
movl READERS_WAKEUP(%r12), %edx
|
||||
movl READERS_WAKEUP(%r12), %r14d
|
||||
|
||||
/* Unlock. */
|
||||
LOCK
|
||||
#if MUTEX == 0
|
||||
subl $1, (%r12)
|
||||
decl (%r12)
|
||||
#else
|
||||
subl $1, MUTEX(%r12)
|
||||
decl MUTEX(%r12)
|
||||
#endif
|
||||
jne 10f
|
||||
|
||||
@ -112,7 +113,8 @@ pthread_rwlock_timedrdlock:
|
||||
movq %rdi, 8(%rsp)
|
||||
|
||||
xorq %rsi, %rsi /* movq $FUTEX_WAIT, %rsi */
|
||||
xorq %r10, %r10
|
||||
movq %rsp, %r10
|
||||
movl %r14d, %edx
|
||||
leaq READERS_WAKEUP(%r12), %rdi
|
||||
movq $SYS_futex, %rax
|
||||
syscall
|
||||
@ -152,6 +154,7 @@ pthread_rwlock_timedrdlock:
|
||||
7: movq %rdx, %rax
|
||||
|
||||
addq $16, %rsp
|
||||
popq %r14
|
||||
popq %r13
|
||||
popq %r12
|
||||
retq
|
||||
|
@ -44,6 +44,7 @@
|
||||
pthread_rwlock_timedwrlock:
|
||||
pushq %r12
|
||||
pushq %r13
|
||||
pushq %r14
|
||||
subq $16, %rsp
|
||||
|
||||
movq %rdi, %r12
|
||||
@ -73,7 +74,7 @@ pthread_rwlock_timedwrlock:
|
||||
incl WRITERS_QUEUED(%r12)
|
||||
je 4f
|
||||
|
||||
movl WRITERS_WAKEUP(%r12), %edx
|
||||
movl WRITERS_WAKEUP(%r12), %r14d
|
||||
|
||||
LOCK
|
||||
#if MUTEX == 0
|
||||
@ -109,6 +110,7 @@ pthread_rwlock_timedwrlock:
|
||||
|
||||
xorq %rsi, %rsi /* movq $FUTEX_WAIT, %rsi */
|
||||
movq %rsp, %r10
|
||||
movl %r14d, %edx
|
||||
leaq WRITERS_WAKEUP(%r12), %rdi
|
||||
movq $SYS_futex, %rax
|
||||
syscall
|
||||
@ -134,7 +136,7 @@ pthread_rwlock_timedwrlock:
|
||||
jmp 9f
|
||||
|
||||
|
||||
5: xorq %rcx, %rdx
|
||||
5: xorq %rdx, %rdx
|
||||
movq %fs:SELF, %rax
|
||||
movq %rax, WRITER(%r12)
|
||||
9: LOCK
|
||||
@ -148,6 +150,7 @@ pthread_rwlock_timedwrlock:
|
||||
7: movq %rdx, %rax
|
||||
|
||||
addq $16, %rsp
|
||||
popq %r14
|
||||
popq %r13
|
||||
popq %r12
|
||||
retq
|
||||
|
@ -51,6 +51,8 @@ tf (void *arg)
|
||||
++ts.tv_sec;
|
||||
}
|
||||
|
||||
puts ("child calling timedrdlock");
|
||||
|
||||
int err = pthread_rwlock_timedrdlock (r, &ts);
|
||||
if (err == 0)
|
||||
{
|
||||
@ -65,6 +67,8 @@ tf (void *arg)
|
||||
pthread_exit ((void *) 1l);
|
||||
}
|
||||
|
||||
puts ("1st child timedrdlock done");
|
||||
|
||||
struct timeval tv2;
|
||||
(void) gettimeofday (&tv2, NULL);
|
||||
|
||||
@ -94,6 +98,8 @@ tf (void *arg)
|
||||
pthread_exit ((void *) 1l);
|
||||
}
|
||||
|
||||
puts ("2nd child timedrdlock done");
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@ -140,16 +146,19 @@ do_test (void)
|
||||
++ts.tv_sec;
|
||||
|
||||
/* Get a write lock. */
|
||||
if (pthread_rwlock_timedwrlock (&r, &ts) != 0)
|
||||
int e = pthread_rwlock_timedwrlock (&r, &ts);
|
||||
if (e != 0)
|
||||
{
|
||||
printf ("round %d: rwlock_wrlock failed\n", cnt);
|
||||
printf ("round %d: rwlock_timedwrlock failed (%d)\n", cnt, e);
|
||||
exit (1);
|
||||
}
|
||||
|
||||
puts ("1st timedwrlock done");
|
||||
|
||||
(void) gettimeofday (&tv, NULL);
|
||||
TIMEVAL_TO_TIMESPEC (&tv, &ts);
|
||||
++ts.tv_sec;
|
||||
int e = pthread_rwlock_timedrdlock (&r, &ts);
|
||||
e = pthread_rwlock_timedrdlock (&r, &ts);
|
||||
if (e == 0)
|
||||
{
|
||||
puts ("timedrdlock succeeded");
|
||||
@ -161,6 +170,8 @@ do_test (void)
|
||||
exit (1);
|
||||
}
|
||||
|
||||
puts ("1st timedrdlock done");
|
||||
|
||||
(void) gettimeofday (&tv, NULL);
|
||||
TIMEVAL_TO_TIMESPEC (&tv, &ts);
|
||||
++ts.tv_sec;
|
||||
@ -176,6 +187,8 @@ do_test (void)
|
||||
exit (1);
|
||||
}
|
||||
|
||||
puts ("2nd timedwrlock done");
|
||||
|
||||
pthread_t th;
|
||||
if (pthread_create (&th, NULL, tf, &r) != 0)
|
||||
{
|
||||
@ -183,6 +196,8 @@ do_test (void)
|
||||
exit (1);
|
||||
}
|
||||
|
||||
puts ("started thread");
|
||||
|
||||
void *status;
|
||||
if (pthread_join (th, &status) != 0)
|
||||
{
|
||||
@ -195,6 +210,8 @@ do_test (void)
|
||||
exit (1);
|
||||
}
|
||||
|
||||
puts ("joined thread");
|
||||
|
||||
if (pthread_rwlock_destroy (&r) != 0)
|
||||
{
|
||||
printf ("round %d: rwlock_destroy failed\n", cnt);
|
||||
|
Loading…
Reference in New Issue
Block a user