summaryrefslogtreecommitdiff
path: root/halimpl
diff options
context:
space:
mode:
authorColin Cross <ccross@android.com>2014-04-08 12:53:11 -0700
committerColin Cross <ccross@android.com>2014-04-08 12:53:11 -0700
commit8d3c6b9faddfe63303c72dd050e25b9673a6e7d8 (patch)
tree648c60d0e37b2e8b0bd482af34054a7ea77866af /halimpl
parent4c9706863b026bdfdba460d8a7eb22cd1a746afc (diff)
downloadlibnfc-nci-8d3c6b9faddfe63303c72dd050e25b9673a6e7d8.tar.gz
nfc: replace pthread_cond_timedwait_monotonic_np
pthread_cond_timedwait_monotonic_np is deprecated, use pthread_condattr_setclock to wait on CLOCK_MONOTONIC instead. Change-Id: Idc620959bb8390bef0e2d8a4888e3431153ca641
Diffstat (limited to 'halimpl')
-rw-r--r--halimpl/bcm2079x/adaptation/CondVar.cpp14
1 files changed, 4 insertions, 10 deletions
diff --git a/halimpl/bcm2079x/adaptation/CondVar.cpp b/halimpl/bcm2079x/adaptation/CondVar.cpp
index 897e8a5..efd449a 100644
--- a/halimpl/bcm2079x/adaptation/CondVar.cpp
+++ b/halimpl/bcm2079x/adaptation/CondVar.cpp
@@ -38,8 +38,11 @@
*******************************************************************************/
CondVar::CondVar ()
{
+ pthread_condattr_t attr;
+ pthread_condattr_init(&attr);
+ pthread_condattr_setclock(&attr, CLOCK_MONOTONIC);
memset (&mCondition, 0, sizeof(mCondition));
- int const res = pthread_cond_init (&mCondition, NULL);
+ int const res = pthread_cond_init (&mCondition, &attr);
if (res)
{
ALOGE ("CondVar::CondVar: fail init; error=0x%X", res);
@@ -117,16 +120,7 @@ bool CondVar::wait (Mutex& mutex, long millisec)
absoluteTime.tv_nsec = ns;
}
- //pthread_cond_timedwait_monotonic_np() is an Android-specific function
- //declared in /development/ndk/platforms/android-9/include/pthread.h;
- //it uses monotonic clock.
- //the standard pthread_cond_timedwait() uses realtime clock.
-#if defined(__LP64__)
- // STOPSHIP need pthread_condattr_setclock(..., CLOCK_MONOTONIC)
int waitResult = pthread_cond_timedwait (&mCondition, mutex.nativeHandle(), &absoluteTime);
-#else
- int waitResult = pthread_cond_timedwait_monotonic_np (&mCondition, mutex.nativeHandle(), &absoluteTime);
-#endif
if ((waitResult != 0) && (waitResult != ETIMEDOUT))
ALOGE ("CondVar::wait: fail timed wait; error=0x%X", waitResult);
retVal = (waitResult == 0); //waited successfully