about summary refs log tree commit diff
path: root/nptl/pthread_mutex_timedlock.c
diff options
context:
space:
mode:
authorAdhemerval Zanella <adhemerval.zanella@linaro.org>2019-02-28 11:33:22 -0300
committerAdhemerval Zanella <adhemerval.zanella@linaro.org>2019-03-05 16:28:20 -0300
commit0ddb7ea842abf63516b74d4b057c052afc6ba863 (patch)
tree92b826163313ba3d4b735db59f1971a9b44f3086 /nptl/pthread_mutex_timedlock.c
parent590675c079d743ecf6fee9f561e46c94633a91ef (diff)
downloadglibc-0ddb7ea842abf63516b74d4b057c052afc6ba863.tar.gz
glibc-0ddb7ea842abf63516b74d4b057c052afc6ba863.tar.xz
glibc-0ddb7ea842abf63516b74d4b057c052afc6ba863.zip
nptl: Assume __ASSUME_FUTEX_CLOCK_REALTIME support
This patch assumes realtime clock support for nptl and thus removes
all the associated code.

For __pthread_mutex_timedlock the fallback usage for the case where
lll_futex_timed_wait_bitset it not set define is also removed. The
generic lowlevellock-futex.h always define it, so for NPTL code the
check always yield true.

Checked on x86_64-linux-gnu and i686-linux-gnu.

	* nptl/nptl-init.c (__have_futex_clock_realtime,
	__have_futex_clock_realtime): Remove definition.
	(__pthread_initialize_minimal_internal): Remove FUTEX_CLOCK_REALTIME
	check test for !__ASSUME_FUTEX_CLOCK_REALTIME.
	* nptl/pthread_mutex_timedlock.c (__pthread_mutex_timedlock): Assume
	__ASSUME_FUTEX_CLOCK_REALTIME support.
	* sysdeps/unix/sysv/linux/i386/lowlevellock.S: Likewise.
	* sysdeps/unix/sysv/linux/x86_64/lowlevellock.S: Likewise.
	* sysdeps/unix/sysv/linux/kernel-features.h
	(__ASSUME_FUTEX_CLOCK_REALTIME): Remove.
	* sysdeps/nptl/lowlevellock-futex.h (lll_futex_timed_wait_bitset):
	Adjust comment.
Diffstat (limited to 'nptl/pthread_mutex_timedlock.c')
-rw-r--r--nptl/pthread_mutex_timedlock.c27
1 files changed, 0 insertions, 27 deletions
diff --git a/nptl/pthread_mutex_timedlock.c b/nptl/pthread_mutex_timedlock.c
index 2f61a7d0d5..270b072c97 100644
--- a/nptl/pthread_mutex_timedlock.c
+++ b/nptl/pthread_mutex_timedlock.c
@@ -240,27 +240,6 @@ __pthread_mutex_timedlock (pthread_mutex_t *mutex,
 	     values despite them being valid.  */
 	  if (__glibc_unlikely (abstime->tv_sec < 0))
 	    return ETIMEDOUT;
-#if (!defined __ASSUME_FUTEX_CLOCK_REALTIME \
-     || !defined lll_futex_timed_wait_bitset)
-	  struct timeval tv;
-	  struct timespec rt;
-
-	  /* Get the current time.  */
-	  (void) __gettimeofday (&tv, NULL);
-
-	  /* Compute relative timeout.  */
-	  rt.tv_sec = abstime->tv_sec - tv.tv_sec;
-	  rt.tv_nsec = abstime->tv_nsec - tv.tv_usec * 1000;
-	  if (rt.tv_nsec < 0)
-	    {
-	      rt.tv_nsec += 1000000000;
-	      --rt.tv_sec;
-	    }
-
-	  /* Already timed out?  */
-	  if (rt.tv_sec < 0)
-	    return ETIMEDOUT;
-#endif
 
 	  /* We cannot acquire the mutex nor has its owner died.  Thus, try
 	     to block using futexes.  Set FUTEX_WAITERS if necessary so that
@@ -287,18 +266,12 @@ __pthread_mutex_timedlock (pthread_mutex_t *mutex,
 	  assume_other_futex_waiters |= FUTEX_WAITERS;
 
 	  /* Block using the futex.  */
-#if (!defined __ASSUME_FUTEX_CLOCK_REALTIME \
-     || !defined lll_futex_timed_wait_bitset)
-	  lll_futex_timed_wait (&mutex->__data.__lock, oldval,
-				&rt, PTHREAD_ROBUST_MUTEX_PSHARED (mutex));
-#else
 	  int err = lll_futex_timed_wait_bitset (&mutex->__data.__lock,
 	      oldval, abstime, FUTEX_CLOCK_REALTIME,
 	      PTHREAD_ROBUST_MUTEX_PSHARED (mutex));
 	  /* The futex call timed out.  */
 	  if (err == -ETIMEDOUT)
 	    return -err;
-#endif
 	  /* Reload current lock value.  */
 	  oldval = mutex->__data.__lock;
 	}