Re: [PATCH 2/4] android/audio: Change mainloop handle in ipc_handler

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

 



Hi Lukasz,

On Thu, Jan 9, 2014 at 1:45 PM, Lukasz Rymanowski
<lukasz.rymanowski@xxxxxxxxx> wrote:
> Make sure we wait 1 sec  after each loop iteration.
> It is important in case of failure that we do not overload cpu.
>
> ---
>  android/hal-audio.c | 5 ++---
>  1 file changed, 2 insertions(+), 3 deletions(-)
>
> diff --git a/android/hal-audio.c b/android/hal-audio.c
> index 7a7c111..4a12bcb 100644
> --- a/android/hal-audio.c
> +++ b/android/hal-audio.c
> @@ -465,15 +465,14 @@ failed:
>
>  static void *ipc_handler(void *data)
>  {
> -       bool done = false;
>         struct pollfd pfd;
> +       bool done;
>
>         DBG("");
>
> -       while (!done) {
> +       for (done = false; !done; sleep(1)) {

This is getting bad really quickly, I did not realize there was a
sleep in it but usually the use of it means we are doing something
wrong which I suspect it has to do with either bind or listen failing
since you are executing them in a loop, in that case I would suggest
to start the listen socket on audio_open and only do the accept in the
thread.



-- 
Luiz Augusto von Dentz
--
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