diff options
Diffstat (limited to 'nptl/tst-rwlock6.c')
-rw-r--r-- | nptl/tst-rwlock6.c | 23 |
1 files changed, 20 insertions, 3 deletions
diff --git a/nptl/tst-rwlock6.c b/nptl/tst-rwlock6.c index ea7f4ba..86cd10b 100644 --- a/nptl/tst-rwlock6.c +++ b/nptl/tst-rwlock6.c @@ -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); |