summaryrefslogtreecommitdiffstats
path: root/libutils/SystemClock.cpp
Commit message (Collapse)AuthorAgeFilesLines
* libutils: fix deadlock in elapsedRealtimeNanoScott Mertz2016-08-291-0/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If n > 2 threads all lock the mutex awaiting the clock method to be set, the 1st thread will first set the method and unlock. The 2nd thread will then take the mutex, but never unlock because the clock_method has already been updated by the 1st thread. This causes a deadlock for threads 3-n. Solution is to ensure the calling thread always unlocks the mutex if it has previously locked it. Log: "main" prio=5 tid=1 Native | group="main" sCount=1 dsCount=0 obj=0x733313b0 self=0xb4cf6500 | sysTid=12786 nice=0 cgrp=default sched=0/0 handle=0xb6f86b44 | state=S schedstat=( 41990410 32985836 80 ) utm=3 stm=1 core=2 HZ=100 | stack=0xbe5fb000-0xbe5fd000 stackSize=8MB | held mutexes= native: #00 pc 00017638 /system/lib/libc.so (syscall+28) native: #01 pc 0003ffa5 /system/lib/libc.so (_ZL33__pthread_mutex_lock_with_timeoutP24pthread_mutex_internal_tPK8timespeci+504) native: #02 pc 000400a9 /system/lib/libc.so (pthread_mutex_lock+26) native: #03 pc 0000fa01 /system/lib/libutils.so (_ZN7android19elapsedRealtimeNanoEv+16) native: #04 pc 0000fb1f /system/lib/libutils.so (_ZN7android15elapsedRealtimeEv+2) native: #05 pc 00214d1d /data/dalvik-cache/arm/system@framework@boot.oat (Java_android_os_SystemClock_elapsedRealtime__+72) "Thread-6372" prio=5 tid=9 Native | group="main" sCount=1 dsCount=0 obj=0x32c05120 self=0xacb58100 | sysTid=12829 nice=10 cgrp=bg_non_interactive sched=0/0 handle=0xb38c3930 | state=S schedstat=( 869427 8219115 17 ) utm=0 stm=0 core=2 HZ=100 | stack=0xb37c1000-0xb37c3000 stackSize=1038KB | held mutexes= native: #00 pc 00017638 /system/lib/libc.so (syscall+28) native: #01 pc 0003ffa5 /system/lib/libc.so (_ZL33__pthread_mutex_lock_with_timeoutP24pthread_mutex_internal_tPK8timespeci+504) native: #02 pc 000400a9 /system/lib/libc.so (pthread_mutex_lock+26) native: #03 pc 0000fa01 /system/lib/libutils.so (_ZN7android19elapsedRealtimeNanoEv+16) native: #04 pc 0000fb1f /system/lib/libutils.so (_ZN7android15elapsedRealtimeEv+2) native: #05 pc 00214d1d /data/dalvik-cache/arm/system@framework@boot.oat (Java_android_os_SystemClock_elapsedRealtime__+72) HAM-1470 Change-Id: I41874d2b0ea034a35a74da030398231089c15cde
* libutils: Improve support for POSIX timersSteve Kondik2015-10-291-17/+42
| | | | | | * Don't repeatedly try to open nonexistent devices where possible. Change-Id: Id1f18d05943a66978d430556fa16ed761e8e464b
* Use __arm__ instead of ARCH_ARM.Elliott Hughes2014-12-041-1/+1
| | | | Change-Id: I777da5757f01d8328d5475e654d56d81dc802655
* libutils: turn on -WerrorMark Salyzyn2014-06-021-9/+7
| | | | | | | | | - Deal with some -Wunused issues - Override PRI macros (windows) - Revert use of PRI macros on off64_t (linux) - Deal with a gnu++11 complaince issue Change-Id: Ie66751293bd84477a5a6dfd8a57e700a16e36964
* SystemClock: use clock_gettime() on devices without /dev/alarmGreg Hackmann2013-12-171-16/+9
| | | | | | | | | | | On devices with an up-to-date kernel, the back-in-time bug affecting clock_gettime() has been fixed and it can safely be used as an alternative to the ANDROID_ALARM_GET_TIME ioctl. To ensure consistent behavior on existing devices, make clock_gettime() a fallback for when the alarm driver isn't available. Change-Id: I384af5e7ec9e73e0bad4b6b0f987a8ea4583cba6 Signed-off-by: Greg Hackmann <ghackmann@google.com>
* Disable timestamp logging.Ben Cheng2013-09-231-0/+13
| | | | | | | | | The kernel problem has been fixed long time ago and the ad-hoc logging mechanism is not thread safe and can flood the log with spurious messages. BUG: 10899829 Change-Id: I63278db51295e744eed3e47dc8d4cfe621c0d8f7
* move libs/utils to libutilsAlex Ray2013-08-021-0/+155
Change-Id: I6cf4268599460791414882f91eeb88a992fbd29d