Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
P
platform_packages_modules_Bluetooth
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
LMODroid
platform_packages_modules_Bluetooth
Commits
b4f404bf
Commit
b4f404bf
authored
10 years ago
by
Ian Coolidge
Committed by
Android Partner Code Review
10 years ago
Browse files
Options
Downloads
Plain Diff
Merge "Fix pthread_t confusion." into m-wireless-dev
parents
56b8988c
ab94b235
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
system/btif/include/btif_hh.h
+2
-1
2 additions, 1 deletion
system/btif/include/btif_hh.h
system/btif/src/btif_sock_thread.c
+16
-18
16 additions, 18 deletions
system/btif/src/btif_sock_thread.c
with
18 additions
and
19 deletions
system/btif/include/btif_hh.h
+
2
−
1
View file @
b4f404bf
...
...
@@ -21,6 +21,7 @@
#include
<hardware/bluetooth.h>
#include
<hardware/bt_hh.h>
#include
<pthread.h>
#include
<stdint.h>
#include
"bta_hh_api.h"
#include
"btu.h"
...
...
@@ -63,7 +64,7 @@ typedef struct
UINT8
sub_class
;
UINT8
app_id
;
int
fd
;
UINT32
hh_poll_thread_id
;
pthread_t
hh_poll_thread_id
;
UINT8
hh_keep_polling
;
BOOLEAN
vup_timer_active
;
TIMER_LIST_ENT
vup_timer
;
...
...
This diff is collapsed.
Click to expand it.
system/btif/src/btif_sock_thread.c
+
16
−
18
View file @
b4f404bf
...
...
@@ -95,7 +95,7 @@ typedef struct {
int
poll_count
;
poll_slot_t
ps
[
MAX_POLL
];
int
psi
[
MAX_POLL
];
//index of poll slot
volatile
p
i
d_t
thread_id
;
volatile
p
threa
d_t
thread_id
;
btsock_signaled_cb
callback
;
btsock_cmd_cb
cmd_callback
;
int
used
;
...
...
@@ -164,19 +164,16 @@ static inline int accept_server_socket(int s)
APPL_TRACE_DEBUG
(
"accepted fd:%d for server fd:%d"
,
fd
,
s
);
return
fd
;
}
static
inline
pthread_t
create_thread
(
void
*
(
*
start_routine
)(
void
*
),
void
*
arg
)
static
inline
int
create_thread
(
void
*
(
*
start_routine
)(
void
*
),
void
*
arg
,
pthread_t
*
thread_id
)
{
pthread_attr_t
thread_attr
;
pthread_attr_init
(
&
thread_attr
);
pthread_attr_setdetachstate
(
&
thread_attr
,
PTHREAD_CREATE_JOINABLE
);
pthread_t
thread_id
=
-
1
;
if
(
pthread_create
(
&
thread_id
,
&
thread_attr
,
start_routine
,
arg
)
!=
0
)
{
APPL_TRACE_ERROR
(
"pthread_create : %s"
,
strerror
(
errno
));
return
-
1
;
}
return
thread_id
;
return
pthread_create
(
thread_id
,
&
thread_attr
,
start_routine
,
arg
);
}
static
void
init_poll
(
int
cmd_fd
);
static
int
alloc_thread_slot
()
{
...
...
@@ -234,17 +231,19 @@ int btsock_thread_create(btsock_signaled_cb callback, btsock_cmd_cb cmd_callback
if
(
h
>=
0
)
{
init_poll
(
h
);
if
((
ts
[
h
].
thread_id
=
create_thread
(
sock_poll_thread
,
(
void
*
)(
uintptr_t
)
h
))
!=
-
1
)
{
APPL_TRACE_DEBUG
(
"h:%d, thread id:%d"
,
h
,
ts
[
h
].
thread_id
);
ts
[
h
].
callback
=
callback
;
ts
[
h
].
cmd_callback
=
cmd_callback
;
}
else
pthread_t
thread
;
int
status
=
create_thread
(
sock_poll_thread
,
(
void
*
)(
uintptr_t
)
h
,
&
thread
);
if
(
status
)
{
APPL_TRACE_ERROR
(
"create_thread failed: %s"
,
strerror
(
status
));
free_thread_slot
(
h
);
h
=
-
1
;
return
-
1
;
}
ts
[
h
].
thread_id
=
thread
;
APPL_TRACE_DEBUG
(
"h:%d, thread id:%d"
,
h
,
ts
[
h
].
thread_id
);
ts
[
h
].
callback
=
callback
;
ts
[
h
].
cmd_callback
=
cmd_callback
;
}
return
h
;
}
...
...
@@ -622,4 +621,3 @@ static void *sock_poll_thread(void *arg)
APPL_TRACE_DEBUG
(
"socket poll thread exiting, h:%d"
,
h
);
return
0
;
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment