aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2003-02-15 22:32:50 +0000
committerUlrich Drepper <drepper@redhat.com>2003-02-15 22:32:50 +0000
commit1c82b97f9624f04f780e2e7f5408d748f07a364d (patch)
tree7e7b229fdecf230f0df3832b5f083298e77e6784
parentb2f05465748e7e1c0105776a1e0ceda7f7a599b0 (diff)
downloadglibc-1c82b97f9624f04f780e2e7f5408d748f07a364d.tar
glibc-1c82b97f9624f04f780e2e7f5408d748f07a364d.tar.gz
glibc-1c82b97f9624f04f780e2e7f5408d748f07a364d.tar.bz2
glibc-1c82b97f9624f04f780e2e7f5408d748f07a364d.zip
Update.
* tst-mutex5.c (do_test): Add more timedlock tests.
-rw-r--r--nptl/Banner2
-rw-r--r--nptl/ChangeLog2
-rw-r--r--nptl/tst-mutex5.c44
-rw-r--r--nptl_db/ChangeLog4
-rw-r--r--nptl_db/td_symbol_list.c4
5 files changed, 50 insertions, 6 deletions
diff --git a/nptl/Banner b/nptl/Banner
index 7f022b3fd8..d5e7cc09cd 100644
--- a/nptl/Banner
+++ b/nptl/Banner
@@ -1 +1 @@
-NPTL 0.21 by Ulrich Drepper
+NPTL 0.22 by Ulrich Drepper
diff --git a/nptl/ChangeLog b/nptl/ChangeLog
index f928819b78..ec74f80b2e 100644
--- a/nptl/ChangeLog
+++ b/nptl/ChangeLog
@@ -1,5 +1,7 @@
2003-02-15 Ulrich Drepper <drepper@redhat.com>
+ * tst-mutex5.c (do_test): Add more timedlock tests.
+
* tst-mutex2.c: Tests of trylock and unlock with ERROR mutexes.
* tst-mutex3.c (do_test): Add tests for trylock with RECURSIVE mutexes.
diff --git a/nptl/tst-mutex5.c b/nptl/tst-mutex5.c
index cfa8d31568..2ade6a7f83 100644
--- a/nptl/tst-mutex5.c
+++ b/nptl/tst-mutex5.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2002 Free Software Foundation, Inc.
+/* Copyright (C) 2002, 2003 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@redhat.com>, 2002.
@@ -60,12 +60,12 @@ do_test (void)
err = pthread_mutex_timedlock (&m, &ts);
if (err == 0)
{
- puts ("timed_lock succeeded");
+ puts ("timedlock succeeded");
return 1;
}
else if (err != ETIMEDOUT)
{
- printf ("timed_lock error != ETIMEDOUT: %d\n", err);
+ printf ("timedlock error != ETIMEDOUT: %d\n", err);
return 1;
}
else
@@ -98,12 +98,50 @@ do_test (void)
}
}
+ (void) gettimeofday (&tv, NULL);
+ TIMEVAL_TO_TIMESPEC (&tv, &ts);
+
+ ts.tv_sec += 2; /* Wait 2 seconds. */
+ /* The following makes the ts value invalid. */
+ ts.tv_nsec += 1000000000;
+
+ err = pthread_mutex_timedlock (&m, &ts);
+ if (err == 0)
+ {
+ puts ("2nd timedlock succeeded");
+ return 1;
+ }
+ else if (err != EINVAL)
+ {
+ printf ("2nd timedlock error != EINVAL: %d\n", err);
+ return 1;
+ }
+
if (pthread_mutex_unlock (&m) != 0)
{
puts ("mutex_unlock failed");
return 1;
}
+ (void) gettimeofday (&tv, NULL);
+ TIMEVAL_TO_TIMESPEC (&tv, &ts);
+
+ ts.tv_sec += 2; /* Wait 2 seconds. */
+ if (pthread_mutex_timedlock (&m, &ts) != 0)
+ {
+ puts ("3rd timedlock failed");
+ }
+
+ (void) gettimeofday (&tv2, NULL);
+
+ /* Check that timedlock didn't delay. We use a limit of 0.1 secs. */
+ timersub (&tv2, &tv, &tv2);
+ if (tv2.tv_sec > 0 || tv2.tv_usec > 100000)
+ {
+ puts ("3rd timedlock didn't return right away");
+ exit (1);
+ }
+
if (pthread_mutex_destroy (&m) != 0)
{
puts ("mutex_destroy failed");
diff --git a/nptl_db/ChangeLog b/nptl_db/ChangeLog
index d4a4ad0d5c..4d6ea58267 100644
--- a/nptl_db/ChangeLog
+++ b/nptl_db/ChangeLog
@@ -1,3 +1,7 @@
+2003-02-15 Ulrich Drepper <drepper@redhat.com>
+
+ * td_symbol_list.c: New symbol name for SYM_PTHREAD_NTHREADS.
+
2003-01-07 Jakub Jelinek <jakub@redhat.com>
* td_ta_event_getmsg.c: Include assert.h.
diff --git a/nptl_db/td_symbol_list.c b/nptl_db/td_symbol_list.c
index f6ba91794a..252faa418d 100644
--- a/nptl_db/td_symbol_list.c
+++ b/nptl_db/td_symbol_list.c
@@ -1,5 +1,5 @@
/* Return list of symbols the library can request.
- Copyright (C) 2001, 2002 Free Software Foundation, Inc.
+ Copyright (C) 2001, 2002, 2003 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@redhat.com>, 2001.
@@ -27,7 +27,7 @@ static const char *symbol_list_arr[] =
{
[SYM_PTHREAD_THREADS_EVENTS] = "__nptl_threads_events",
[SYM_PTHREAD_LAST_EVENT] = "__nptl_last_event",
- [SYM_PTHREAD_NTHREADS] = "nptl_nthreads",
+ [SYM_PTHREAD_NTHREADS] = "__nptl_nthreads",
[SYM_PTHREAD_STACK_USED] = "stack_used",
[SYM_PTHREAD_STACK_USER] = "__stack_user",
[SYM_PTHREAD_KEYS] = "__pthread_keys",