@@ -485,12 +485,13 @@ static int snd_pcm_shm_drain(snd_pcm_t *pcm)
snd_pcm_shm_t *shm = pcm->private_data;
volatile snd_pcm_shm_ctrl_t *ctrl = shm->ctrl;
int err;
+ struct timespec req = { 0, 10 * 1000 * 1000 };
do {
ctrl->cmd = SNDRV_PCM_IOCTL_DRAIN;
err = snd_pcm_shm_action(pcm);
if (err != -EAGAIN)
break;
- usleep(10000);
+ nanosleep(&req, NULL);
} while (1);
if (err < 0)
return err;
@@ -359,6 +359,7 @@ static int execute_sequence(snd_use_case_mgr_t *uc_mgr,
{
struct list_head *pos;
struct sequence_element *s;
+ struct timespec sleep = { 0, s->data.sleep * 1000 };
char *cdev = NULL;
snd_ctl_t *ctl = NULL;
int err = 0;
@@ -440,7 +441,7 @@ static int execute_sequence(snd_use_case_mgr_t *uc_mgr,
}
break;
case SEQUENCE_ELEMENT_TYPE_SLEEP:
- usleep(s->data.sleep);
+ nanosleep(&sleep, NULL);
break;
case SEQUENCE_ELEMENT_TYPE_EXEC:
err = system(s->data.exec);
@@ -77,7 +77,7 @@ static double detect_cpu_clock()
rdtscll(tsc_begin);
clock_gettime(CLOCK_MONOTONIC, &tm_begin);
- usleep(1000000);
+ sleep(1);
rdtscll(tsc_end);
clock_gettime(CLOCK_MONOTONIC, &tm_end);
usleep was deprecated by POSIX 2008 and is unavailable without deprecated APIs enabled in uClibc-ng. Signed-off-by: Rosen Penev <rosenp@gmail.com> --- src/pcm/pcm_shm.c | 3 ++- src/ucm/main.c | 3 ++- test/mixtest.c | 2 +- 3 files changed, 5 insertions(+), 3 deletions(-)