Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
halo
external_libnfc-nci
Commits
46abb3dc
Commit
46abb3dc
authored
11 years ago
by
Martijn Coenen
Committed by
Gerrit Code Review
11 years ago
Browse files
Options
Download
Plain Diff
Merge "Fix up pthread_cond_timedwait."
parents
132e8137
51ca88d3
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
20 deletions
+11
-20
halimpl/bcm2079x/gki/ulinux/gki_ulinux.c
halimpl/bcm2079x/gki/ulinux/gki_ulinux.c
+5
-10
src/gki/ulinux/gki_ulinux.c
src/gki/ulinux/gki_ulinux.c
+6
-10
No files found.
halimpl/bcm2079x/gki/ulinux/gki_ulinux.c
View file @
46abb3dc
...
...
@@ -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
...
...
This diff is collapsed.
Click to expand it.
src/gki/ulinux/gki_ulinux.c
View file @
46abb3dc
...
...
@@ -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
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment