diff options
author | Yu Ning <yu.ning@intel.com> | 2016-03-31 21:49:59 +0800 |
---|---|---|
committer | bohu <bohu@google.com> | 2016-04-07 17:32:23 -0700 |
commit | f3769c17615bc9c227cff83cad0e55bb9f878197 (patch) | |
tree | 578637a55a7acc8669116d3cab54719c9f37891c /reference-ril/atchannel.c | |
parent | 99f6a4e8fa12a6d54df5420aaa3eda29d9ba22a6 (diff) | |
download | android_hardware_ril-f3769c17615bc9c227cff83cad0e55bb9f878197.tar.gz android_hardware_ril-f3769c17615bc9c227cff83cad0e55bb9f878197.tar.bz2 android_hardware_ril-f3769c17615bc9c227cff83cad0e55bb9f878197.zip |
reference-ril: Stop using pthread_cond_timedwait_relative_np()
pthread_cond_timedwait_relative_np() is deprecated, and is only
available in the 32-bit ABI (see bionic/libc/include/pthread.h). It is
still used by the 32-bit version of reference-ril. Thanks to a recent
bugfix for 64-bit [1], it is now safe to replace the deprecated
function with the standard pthread_cond_timedwait(). Doing so also
simplifies the code, as there is now a unified logic for 32 and 64-bit
targets.
[1] https://android-review.googlesource.com/210301
Signed-off-by: Yu Ning <yu.ning@intel.com>
(cherry picked from commit 3480b1832d3581c708868117c0eb21ba291df165)
Change-Id: I1a15ee0fdfea38b6ee9c9fd49845d10d45f485b1
Diffstat (limited to 'reference-ril/atchannel.c')
-rw-r--r-- | reference-ril/atchannel.c | 17 |
1 files changed, 0 insertions, 17 deletions
diff --git a/reference-ril/atchannel.c b/reference-ril/atchannel.c index ac01cbc..6124d88 100644 --- a/reference-ril/atchannel.c +++ b/reference-ril/atchannel.c @@ -35,10 +35,6 @@ #include "misc.h" -#ifdef HAVE_PTHREAD_COND_TIMEDWAIT_RELATIVE -#define USE_NP 1 -#endif /* HAVE_PTHREAD_COND_TIMEDWAIT_RELATIVE */ - #define NUM_ELEMS(x) (sizeof(x)/sizeof(x[0])) @@ -85,7 +81,6 @@ static void onReaderClosed(); static int writeCtrlZ (const char *s); static int writeline (const char *s); -#ifndef USE_NP #define NS_PER_S 1000000000 static void setTimespecRelative(struct timespec *p_ts, long long msec) { @@ -93,9 +88,6 @@ static void setTimespecRelative(struct timespec *p_ts, long long msec) gettimeofday(&tv, (struct timezone *) NULL); - /* what's really funny about this is that I know - pthread_cond_timedwait just turns around and makes this - a relative time again */ p_ts->tv_sec = tv.tv_sec + (msec / 1000); p_ts->tv_nsec = (tv.tv_usec + (msec % 1000) * 1000L ) * 1000L; /* assuming tv.tv_usec < 10^6 */ @@ -104,7 +96,6 @@ static void setTimespecRelative(struct timespec *p_ts, long long msec) p_ts->tv_nsec -= NS_PER_S; } } -#endif /*USE_NP*/ static void sleepMsec(long long msec) { @@ -678,9 +669,7 @@ static int at_send_command_full_nolock (const char *command, ATCommandType type, long long timeoutMsec, ATResponse **pp_outResponse) { int err = 0; -#ifndef USE_NP struct timespec ts; -#endif /*USE_NP*/ if(sp_response != NULL) { err = AT_ERROR_COMMAND_PENDING; @@ -698,19 +687,13 @@ static int at_send_command_full_nolock (const char *command, ATCommandType type, s_smsPDU = smspdu; sp_response = at_response_new(); -#ifndef USE_NP if (timeoutMsec != 0) { setTimespecRelative(&ts, timeoutMsec); } -#endif /*USE_NP*/ while (sp_response->finalResponse == NULL && s_readerClosed == 0) { if (timeoutMsec != 0) { -#ifdef USE_NP - err = pthread_cond_timeout_np(&s_commandcond, &s_commandmutex, timeoutMsec); -#else err = pthread_cond_timedwait(&s_commandcond, &s_commandmutex, &ts); -#endif /*USE_NP*/ } else { err = pthread_cond_wait(&s_commandcond, &s_commandmutex); } |