From c8f834c4ee32020915949f762801832a215c6d2b Mon Sep 17 00:00:00 2001 From: Keith Mok Date: Fri, 19 Feb 2016 12:44:16 -0800 Subject: bootanimation: Use CLOCK_MONTONIC for pthread Use CLOCK_REALTIME can mess up the pthread timed wait if system clock changes. Change-Id: I7e14958460ccd1ecd8c9aa3cdfa4e60dd2a083ec --- cmds/bootanimation/BootAnimation.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'cmds') 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