All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ivan Sorokin <sorokin@rain.ifmo.ru>
To: alsa-devel@alsa-project.org
Subject: snd_pcm_writei returns -EAGAIN after poll
Date: Sun, 20 Mar 2011 05:21:17 +0300	[thread overview]
Message-ID: <4D85649D.20107@rain.ifmo.ru> (raw)

Hello!

I use slightly modified test/pcm.c in write_and_poll mode.

My program looks like this:

snd_pcm_open with SND_PCM_NONBLOCK
snd_pcm_set_params

infinite loop
    poll for snd_pcm_poll_descriptors
    snd_pcm_poll_descriptors_revents
    if POLLOUT flag is set
       snd_pcm_writei

Everything works, but snd_pcm_writei sometimes returns -EAGAIN. The 
probability of when snd_pcm_writei returns -EAGAIN depends on buffer 
size that I pass to it. ExperimentallyI found out that when I call 
snd_pcm_writei with 940 bytes buffers (maybe something related to period 
size?) it never returns -EAGAIN.

Why poll returns when there is no place for new data? Is it ok to ignore 
EAGAIN and just start another poll? Is there any recommended buffer size 
for snd_pcm_writei?

My test program: 
https://github.com/sorokin/asoundpp/blob/master/sine_async.cpp (94 LOC)

             reply	other threads:[~2011-03-20  2:23 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-03-20  2:21 Ivan Sorokin [this message]
2011-03-20  2:40 ` snd_pcm_writei returns -EAGAIN after poll Raymond Yau

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4D85649D.20107@rain.ifmo.ru \
    --to=sorokin@rain.ifmo.ru \
    --cc=alsa-devel@alsa-project.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.