Commit 46abb3dc authored by Martijn Coenen's avatar Martijn Coenen Committed by Gerrit Code Review
Browse files

Merge "Fix up pthread_cond_timedwait."

parents 132e8137 51ca88d3
......@@ -41,8 +41,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
......@@ -222,8 +220,11 @@ UINT8 GKI_create_task (TASKPTR task_entry, UINT8 task_id, INT8 *taskname, UINT16
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)
......@@ -240,9 +241,9 @@ UINT8 GKI_create_task (TASKPTR task_entry, UINT8 task_id, INT8 *taskname, UINT16
/* 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 */
......@@ -703,14 +704,8 @@ UINT16 GKI_wait (UINT16 flag, UINT32 timeout)
}
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
......
......@@ -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 GKI_create_task (TASKPTR task_entry, UINT8 task_id, INT8 *taskname, UINT16
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 @@ UINT8 GKI_create_task (TASKPTR task_entry, UINT8 task_id, INT8 *taskname, UINT16
/* 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 @@ UINT16 GKI_wait (UINT16 flag, UINT32 timeout)
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
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment