Re: [RFCv0 07/14] android/hal-sco: Use global sco file descriptor

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Luiz,

On Tue, May 27, 2014 at 04:08:09PM +0300, Luiz Augusto von Dentz wrote:
> Hi Andrei,
> 
> On Thu, May 22, 2014 at 3:06 PM, Andrei Emeltchenko
> <Andrei.Emeltchenko.news@xxxxxxxxx> wrote:
> > From: Andrei Emeltchenko <andrei.emeltchenko@xxxxxxxxx>
> >
> > Android may open input/output stream independently so we use global sco
> > file descriptor and mutexes.
> > ---
> >  android/hal-sco.c | 85 ++++++++++++++++++++++++++++++++-----------------------
> >  1 file changed, 50 insertions(+), 35 deletions(-)
> >
> > diff --git a/android/hal-sco.c b/android/hal-sco.c
> > index e940547..8c2549b 100644
> > --- a/android/hal-sco.c
> > +++ b/android/hal-sco.c
> > @@ -46,6 +46,10 @@
> >  static int listen_sk = -1;
> >  static int ipc_sk = -1;
> >
> > +static int sco_fd = -1;
> > +static uint16_t sco_mtu = 0;
> > +static pthread_mutex_t sco_mutex = PTHREAD_MUTEX_INITIALIZER;
> > +
> 
> Do we really need a mutex for this? I mean this is almost the same as
> protecting the device itself for opening concurrent input and output,
> if that is the case then I think it is better to put the mutex there.
> 

For some reason Android tries to open several input streams from different
threads. So input/output streams looks might be open/closed from different
threads.

Best regards 
Andrei Emeltchenko 

--
To unsubscribe from this list: send the line "unsubscribe linux-bluetooth" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Bluez Devel]     [Linux Wireless Networking]     [Linux Wireless Personal Area Networking]     [Linux ATH6KL]     [Linux USB Devel]     [Linux Media Drivers]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Big List of Linux Books]

  Powered by Linux