OSDN Git Service

Fixed deadlock issue for concurrent multiple rfcomm connections.
authorgit-zhenye.broadcom.com <zhenye@broadcom.com>
Thu, 12 Jun 2014 23:52:46 +0000 (16:52 -0700)
committergit-zhenye.broadcom.com <zhenye@broadcom.com>
Tue, 1 Jul 2014 22:11:23 +0000 (15:11 -0700)
Bug 15469934

Change-Id: I77a3dc97c92f0ccd5764220e8e0bf5c0689d7b12

btif/src/btif_sock_rfc.c

index 3f2d7c3..698191f 100644 (file)
@@ -888,7 +888,14 @@ void btsock_rfc_signaled(int fd, int flags, uint32_t user_id)
                     //make sure there's data pending in case the peer closed the socket
                     if(!(flags & SOCK_THREAD_FD_EXCEPTION) ||
                                 (ioctl(rs->fd, FIONREAD, &size) == 0 && size))
-                        BTA_JvRfcommWrite(rs->rfc_handle, (UINT32)rs->id);
+                    {
+                        int rfc_handle = rs->rfc_handle;
+                        UINT32 rs_id = rs->id;
+                        //unlock before BTA_JvRfcommWrite to avoid deadlock on concurrnet multi rfcomm connectoins
+                        unlock_slot(&slot_lock);
+                        BTA_JvRfcommWrite(rfc_handle, rs_id);
+                        return;
+                    }
                 }
                 else
                 {