summaryrefslogtreecommitdiffstats
path: root/btif/src/btif_hl.c
diff options
context:
space:
mode:
Diffstat (limited to 'btif/src/btif_hl.c')
-rwxr-xr-xbtif/src/btif_hl.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/btif/src/btif_hl.c b/btif/src/btif_hl.c
index 954a985..93f35fe 100755
--- a/btif/src/btif_hl.c
+++ b/btif/src/btif_hl.c
@@ -5051,6 +5051,11 @@ static inline int btif_hl_close_select_thread(void)
char sig_on = btif_hl_signal_select_exit;
BTIF_TRACE_DEBUG0("btif_hl_signal_select_exit");
result = send(signal_fds[1], &sig_on, sizeof(sig_on), 0);
+ /* Wait for the select_thread_id to exit */
+ if (select_thread_id != -1) {
+ pthread_join(select_thread_id, NULL);
+ select_thread_id = -1;
+ }
/* Cleanup signal sockets */
if(signal_fds[0] != -1)
{
@@ -5112,7 +5117,6 @@ static void btif_hl_thread_cleanup(){
close(connected_s);
}
listen_s = connected_s = -1;
- select_thread_id = -1;
BTIF_TRACE_DEBUG0("hl thread cleanup");
}
/*******************************************************************************
@@ -5145,6 +5149,7 @@ static void *btif_hl_select_thread(void *arg){
{
BTIF_TRACE_DEBUG0("select() ret -1, exit the thread");
btif_hl_thread_cleanup();
+ select_thread_id = -1;
return 0;
}
else if (ret)