Fix up pthread_cond_timedwait.
pthread_cond_timedwait_monotonic{_np} is deprecated,
use pthread_condattr_setclock instead.
Change-Id: Icdeaa52c3b1673f3109795ef81dc9e6b9e2bcd4c
diff --git a/src/gki/ulinux/gki_ulinux.c b/src/gki/ulinux/gki_ulinux.c
index 9e487a1..93fd553 100644
--- a/src/gki/ulinux/gki_ulinux.c
+++ b/src/gki/ulinux/gki_ulinux.c
@@ -40,8 +40,6 @@
#define SCHED_RR 2
#define SCHED_BATCH 3
-#define pthread_cond_timedwait_monotonic pthread_cond_timedwait
-
#endif
/* Define the structure that holds the GKI variables
@@ -219,8 +217,11 @@
UINT8 *p;
struct sched_param param;
int policy, ret = 0;
+ pthread_condattr_t attr;
pthread_attr_t attr1;
+ pthread_condattr_init(&attr);
+ pthread_condattr_setclock(&attr, CLOCK_MONOTONIC);
GKI_TRACE_5 ("GKI_create_task func=0x%x id=%d name=%s stack=0x%x stackSize=%d", task_entry, task_id, taskname, stack, stacksize);
if (task_id >= GKI_MAX_TASKS)
@@ -237,9 +238,9 @@
/* Initialize mutex and condition variable objects for events and timeouts */
pthread_mutex_init(&gki_cb.os.thread_evt_mutex[task_id], NULL);
- pthread_cond_init (&gki_cb.os.thread_evt_cond[task_id], NULL);
+ pthread_cond_init (&gki_cb.os.thread_evt_cond[task_id], &attr);
pthread_mutex_init(&gki_cb.os.thread_timeout_mutex[task_id], NULL);
- pthread_cond_init (&gki_cb.os.thread_timeout_cond[task_id], NULL);
+ pthread_cond_init (&gki_cb.os.thread_timeout_cond[task_id], &attr);
pthread_attr_init(&attr1);
/* by default, pthread creates a joinable thread */
@@ -679,14 +680,9 @@
abstime.tv_nsec = abstime.tv_nsec % NSEC_PER_SEC;
}
abstime.tv_sec += sec;
-#if defined(__LP64__)
- // STOPSHIP need pthread_condattr_setclock(..., CLOCK_MONOTONIC)
+
pthread_cond_timedwait(&gki_cb.os.thread_evt_cond[rtask],
&gki_cb.os.thread_evt_mutex[rtask], &abstime);
-#else
- pthread_cond_timedwait_monotonic(&gki_cb.os.thread_evt_cond[rtask],
- &gki_cb.os.thread_evt_mutex[rtask], &abstime);
-#endif
}
else