>> what do you mean by async mode? i'm one of the more experienced ALSA
>> programmers, and i have no idea what you're referring to. is this ALSA
>> 0.9.X, or 0.5.X?
>
>The async notification is a new feature of the 0.9.X API. The ALSA drivers
>can generate SIGIO signal when the poll condition is accomplished. It's
>nice feature to avoid using pthreads.

have you ever bothered to check the list of calls that are async safe?
IMHO, although i agree that ALSA should support this, its really
totally useless if you want to write safe code. just about all the
SIGIO handler can do is to set a flag - something else has to be
responsible for actually handling the fact that i/o is
possible. perhaps some people consider this an improvement over
pthreads, perhaps others think its good to have the choice. i've
written both kinds of systems, and i think people who want to use
SIGIO are misguided. 

i'd also note that async i/o was developed for filesystems, not
streaming devices. async i/o is very helpful for devices like disks,
where there is no "real time" requirement (i.e. the disk doesn't care
*when* you do i/o); its vastly less useful for devices like audio and
streaming video interfaces where it absolutely does matter *when* the
i/o happens. this means that you still need some other kind of regular
interval timer to ensure that the flag set by the SIGIO handler is
acted upon promptly. i don't understand why you'd choose some other
timer rather than the PCM interrupt unless you were handling, say,
video and audio. even in that case, I'd probably use the PCM
interrupt since it has much greater resolution than any video timer (i
think). 

let me reiterate: you cannot safely call functions in alsa-lib from
the SIGIO handler, because alsa lib makes repeated calls to functions
that are not async safe. i also do not know the extent to which linux
POSIX compliance ensures that even those functions that are supposed
to async safe actually are.

just my $0.02 rant :)

--p


_______________________________________________
Alsa-devel mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/alsa-devel

Reply via email to