summaryrefslogtreecommitdiffstats
path: root/libc
diff options
context:
space:
mode:
authorElliott Hughes <enh@google.com>2013-07-19 17:13:33 -0700
committerAndroid Git Automerger <android-git-automerger@android.com>2013-07-19 17:13:33 -0700
commitc2902edfc4aaa02977eef7154d05d5369bc48281 (patch)
tree1c2f24182acb717f4eff77fa28a89a878cdbbe48 /libc
parent178c41857321732259c3e22d73c86c22ae4359b5 (diff)
parent6fe4a58f84954523f17114f1f7cf060a3573c073 (diff)
downloadbionic-c2902edfc4aaa02977eef7154d05d5369bc48281.zip
bionic-c2902edfc4aaa02977eef7154d05d5369bc48281.tar.gz
bionic-c2902edfc4aaa02977eef7154d05d5369bc48281.tar.bz2
am 6fe4a58f: Merge "Move stuff only needed by pthread-timers.c into pthread-timers.c."
* commit '6fe4a58f84954523f17114f1f7cf060a3573c073': Move stuff only needed by pthread-timers.c into pthread-timers.c.
Diffstat (limited to 'libc')
-rw-r--r--libc/bionic/pthread-timers.c49
-rw-r--r--libc/bionic/pthread_internal.h59
2 files changed, 49 insertions, 59 deletions
diff --git a/libc/bionic/pthread-timers.c b/libc/bionic/pthread-timers.c
index 2ad0b90..d81bfef 100644
--- a/libc/bionic/pthread-timers.c
+++ b/libc/bionic/pthread-timers.c
@@ -33,6 +33,12 @@
#include <stdio.h>
#include <string.h>
+extern int __pthread_cond_timedwait(pthread_cond_t*, pthread_mutex_t*, const struct timespec*,
+ clockid_t);
+
+extern int __pthread_cond_timedwait_relative(pthread_cond_t*, pthread_mutex_t*,
+ const struct timespec*);
+
// Normal (i.e. non-SIGEV_THREAD) timers are created directly by the kernel
// and are passed as is to/from the caller.
//
@@ -279,6 +285,49 @@ thr_timer_unlock( thr_timer_t* t )
pthread_mutex_unlock(&t->mutex);
}
+
+static __inline__ void timespec_add(struct timespec* a, const struct timespec* b) {
+ a->tv_sec += b->tv_sec;
+ a->tv_nsec += b->tv_nsec;
+ if (a->tv_nsec >= 1000000000) {
+ a->tv_nsec -= 1000000000;
+ a->tv_sec += 1;
+ }
+}
+
+static __inline__ void timespec_sub(struct timespec* a, const struct timespec* b) {
+ a->tv_sec -= b->tv_sec;
+ a->tv_nsec -= b->tv_nsec;
+ if (a->tv_nsec < 0) {
+ a->tv_nsec += 1000000000;
+ a->tv_sec -= 1;
+ }
+}
+
+static __inline__ void timespec_zero(struct timespec* a) {
+ a->tv_sec = a->tv_nsec = 0;
+}
+
+static __inline__ int timespec_is_zero(const struct timespec* a) {
+ return (a->tv_sec == 0 && a->tv_nsec == 0);
+}
+
+static __inline__ int timespec_cmp(const struct timespec* a, const struct timespec* b) {
+ if (a->tv_sec < b->tv_sec) return -1;
+ if (a->tv_sec > b->tv_sec) return +1;
+ if (a->tv_nsec < b->tv_nsec) return -1;
+ if (a->tv_nsec > b->tv_nsec) return +1;
+ return 0;
+}
+
+static __inline__ int timespec_cmp0(const struct timespec* a) {
+ if (a->tv_sec < 0) return -1;
+ if (a->tv_sec > 0) return +1;
+ if (a->tv_nsec < 0) return -1;
+ if (a->tv_nsec > 0) return +1;
+ return 0;
+}
+
/** POSIX TIMERS APIs */
extern int __timer_create(clockid_t, struct sigevent*, timer_t*);
diff --git a/libc/bionic/pthread_internal.h b/libc/bionic/pthread_internal.h
index 98199d3..31b8ca7 100644
--- a/libc/bionic/pthread_internal.h
+++ b/libc/bionic/pthread_internal.h
@@ -80,65 +80,6 @@ __LIBC_HIDDEN__ void _pthread_internal_remove_locked(pthread_internal_t* thread)
__LIBC_HIDDEN__ extern pthread_internal_t* gThreadList;
__LIBC_HIDDEN__ extern pthread_mutex_t gThreadListLock;
-/* needed by posix-timers.c */
-
-static __inline__ void timespec_add( struct timespec* a, const struct timespec* b )
-{
- a->tv_sec += b->tv_sec;
- a->tv_nsec += b->tv_nsec;
- if (a->tv_nsec >= 1000000000) {
- a->tv_nsec -= 1000000000;
- a->tv_sec += 1;
- }
-}
-
-static __inline__ void timespec_sub( struct timespec* a, const struct timespec* b )
-{
- a->tv_sec -= b->tv_sec;
- a->tv_nsec -= b->tv_nsec;
- if (a->tv_nsec < 0) {
- a->tv_nsec += 1000000000;
- a->tv_sec -= 1;
- }
-}
-
-static __inline__ void timespec_zero( struct timespec* a )
-{
- a->tv_sec = a->tv_nsec = 0;
-}
-
-static __inline__ int timespec_is_zero( const struct timespec* a )
-{
- return (a->tv_sec == 0 && a->tv_nsec == 0);
-}
-
-static __inline__ int timespec_cmp( const struct timespec* a, const struct timespec* b )
-{
- if (a->tv_sec < b->tv_sec) return -1;
- if (a->tv_sec > b->tv_sec) return +1;
- if (a->tv_nsec < b->tv_nsec) return -1;
- if (a->tv_nsec > b->tv_nsec) return +1;
- return 0;
-}
-
-static __inline__ int timespec_cmp0( const struct timespec* a )
-{
- if (a->tv_sec < 0) return -1;
- if (a->tv_sec > 0) return +1;
- if (a->tv_nsec < 0) return -1;
- if (a->tv_nsec > 0) return +1;
- return 0;
-}
-
-extern int __pthread_cond_timedwait(pthread_cond_t*,
- pthread_mutex_t*,
- const struct timespec*,
- clockid_t);
-
-extern int __pthread_cond_timedwait_relative(pthread_cond_t*,
- pthread_mutex_t*,
- const struct timespec*);
-
/* needed by fork.c */
extern void __timer_table_start_stop(int stop);
extern void __bionic_atfork_run_prepare();