summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKausik Sinnaswamy <kausik@broadcom.com>2012-09-11 12:06:20 +0530
committerMatthew Xie <mattx@google.com>2012-09-11 00:35:57 -0700
commitec4625e9696bd87e93e3dfe625e7e0bca2d03410 (patch)
tree9c1bde016f3da1a4ad06ab8d847bae6c004f73b8
parent006e31e8bd33851be7547bf6540617976495f467 (diff)
downloadexternal_bluetooth_bluedroid-ec4625e9696bd87e93e3dfe625e7e0bca2d03410.zip
external_bluetooth_bluedroid-ec4625e9696bd87e93e3dfe625e7e0bca2d03410.tar.gz
external_bluetooth_bluedroid-ec4625e9696bd87e93e3dfe625e7e0bca2d03410.tar.bz2
Fix for HDP thread leak during BT on/off
During cleanup, we were not doing a pthread_join of the thread that was created as part of the init API. The fix was to do a join during cleanup bug 7083069 Change-Id: I48c7b597e969d08de36365abd6bbd321001b4e0d
-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)