Skip to content

Commit

Permalink
Extend pthread_cond_timedwait tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
Ulrich Drepper committed Jul 18, 2009
1 parent e88726b commit f8b6cd2
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
3 changes: 3 additions & 0 deletions nptl/ChangeLog
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
2009-07-18 Ulrich Drepper <drepper@redhat.com>

* tst-cond11.c (run_test): Add test to check that the timeout is
long enough.

* sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S
(__pthread_cond_timedwait): If possible use FUTEX_WAIT_BITSET to
directly use absolute timeout.
Expand Down
16 changes: 15 additions & 1 deletion nptl/tst-cond11.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* Copyright (C) 2003, 2004 Free Software Foundation, Inc.
/* Copyright (C) 2003, 2004, 2009 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@redhat.com>, 2003.
Expand Down Expand Up @@ -130,6 +130,20 @@ run_test (clockid_t cl)
return 1;
}

struct timespec ts2;
if (clock_gettime (cl, &ts2) != 0)
{
puts ("second clock_gettime failed");
return 1;
}

if (ts2.tv_sec < ts.tv_sec
|| (ts2.tv_sec == ts.tv_sec && ts2.tv_nsec < ts.tv_nsec))
{
puts ("timeout too short");
return 1;
}

if (pthread_mutex_unlock (&mut) != 0)
{
puts ("mutex_unlock failed");
Expand Down

0 comments on commit f8b6cd2

Please sign in to comment.