diff options
author | Colin Cross <ccross@android.com> | 2014-04-08 12:53:11 -0700 |
---|---|---|
committer | Martijn Coenen <maco@google.com> | 2014-04-08 13:21:38 -0700 |
commit | eabd7b11033ffbd799fcd122ab0b3e1769e94927 (patch) | |
tree | 62d17c14cb0ba13a54bcc90c47aefc98e6f3b7c4 /halimpl | |
parent | 8fcd301eed3c4577020688b09552278d26731f13 (diff) | |
download | libnfc-nci-eabd7b11033ffbd799fcd122ab0b3e1769e94927.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.cpp | 14 |
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 |