diff options
author | Keith Mok <kmok@cyngn.com> | 2016-02-19 12:44:16 -0800 |
---|---|---|
committer | Steve Kondik <shade@chemlab.org> | 2016-02-20 10:13:47 -0800 |
commit | c8f834c4ee32020915949f762801832a215c6d2b (patch) | |
tree | 86f80c3f9602832b6a11f0c9d770946e5ac2ea71 /cmds/bootanimation | |
parent | 6929ea6c4fdbd80ec50bc21a6bc41155bbcc3626 (diff) | |
download | frameworks_base-c8f834c4ee32020915949f762801832a215c6d2b.zip frameworks_base-c8f834c4ee32020915949f762801832a215c6d2b.tar.gz frameworks_base-c8f834c4ee32020915949f762801832a215c6d2b.tar.bz2 |
bootanimation: Use CLOCK_MONTONIC for pthread
Use CLOCK_REALTIME can mess up the pthread timed
wait if system clock changes.
Change-Id: I7e14958460ccd1ecd8c9aa3cdfa4e60dd2a083ec
Diffstat (limited to 'cmds/bootanimation')
-rw-r--r-- | cmds/bootanimation/BootAnimation.cpp | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/cmds/bootanimation/BootAnimation.cpp b/cmds/bootanimation/BootAnimation.cpp index b83c7ab..4e7c9c4 100644 --- a/cmds/bootanimation/BootAnimation.cpp +++ b/cmds/bootanimation/BootAnimation.cpp @@ -734,7 +734,10 @@ bool BootAnimation::movie() clearReg.subtractSelf(Rect(xc, yc, xc+animation.width, yc+animation.height)); pthread_mutex_init(&mp_lock, NULL); - pthread_cond_init(&mp_cond, NULL); + pthread_condattr_t attr; + pthread_condattr_init(&attr); + pthread_condattr_setclock(&attr, CLOCK_MONOTONIC); + pthread_cond_init(&mp_cond, &attr); for (size_t i=0 ; i<pcount ; i++) { const Animation::Part& part(animation.parts[i]); @@ -867,7 +870,7 @@ bool BootAnimation::movie() if (isMPlayerPrepared) { ALOGD("waiting for media player to complete."); struct timespec timeout; - clock_gettime(CLOCK_REALTIME, &timeout); + clock_gettime(CLOCK_MONOTONIC, &timeout); timeout.tv_sec += 5; //timeout after 5s. pthread_mutex_lock(&mp_lock); |