>> that said, i think it would be great if this found its way into libasound.
>
>is the below code ok?
>
>int snd_pcm_wait_many(snd_pcm_t **handles, int num_handles, int timeout)
>{
>       struct pollfd *pfds;
>       int i, err;
>       pfds = (struct pollfd *)alloca(sizeof(*pfds) * num_handles);
>       if (! pfds)
>               reutrn -ENOMEM;
>       for (i = 0; i < num_handles; i++) {
>               err = snd_pcm_poll_descriptors(handles[i], &pfds[i], 1);
>               assert(err == 1);
>       }
>       err = poll(pfds, num_handles, timeout);
>       if (err < 0)
>               return -errno;
>       return err > 0 ? 1 : 0;
>}

this isn't even close. the function in question waits until each and
every handle is ready. that means reentering poll over and over again
until each handle is ready, making sure to only poll on the handles
that are not yet ready (because otherwise poll returns immediately).

the semantics are not "wait for any one many", its "wait for all or an
error".

if someone wants to write the function that joshua was thinking of, i
would suggest starting with the JACK alsa function and explain how it
can be made simpler.

--p


-------------------------------------------------------
This SF.NET email is sponsored by: FREE  SSL Guide from Thawte
are you planning your Web Server Security? Click here to get a FREE
Thawte SSL guide and find the answers to all your  SSL security issues.
http://ads.sourceforge.net/cgi-bin/redirect.pl?thaw0026en
_______________________________________________
Alsa-devel mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/alsa-devel

Reply via email to