-
Notifications
You must be signed in to change notification settings - Fork 341
Open
Description
Hi,
I was looking through the code, as an example of how to use the alsa API, I was wondering where the waiting occurs as:
- The read, write functions are non blocking:
result = snd_pcm_open(&phandle, name.c_str(), stream, openMode | SND_PCM_NONBLOCK); - The callback handler is a tight loop:
while (*isRunning == true)
{
pthread_testcancel();
object->callbackEvent();
}
- The only waiting is to handle stopping the stream:
if (stream_.state == STREAM_STOPPED)
{
MUTEX_LOCK(&stream_.mutex);
while (!apiInfo->runnable) pthread_cond_wait(&apiInfo->runnable_cv, &stream_.mutex);
...
}
- There is no handling of EAGAIN, only EPIPE:
if (result < (int)stream_.bufferSize)
{
// Either an error or overrun occurred.
if (result == -EPIPE)
{
...
Any insight would be much appreciated!
Metadata
Metadata
Assignees
Labels
No labels