This is the relevant code. In aperiodic mode, it works fine. In periodic
mode (125us timebase) then when I activate this task by sending data to
/dev/dsp the sound plays very fast and then the watchdog kills the
thread. If I change this to set the period only after rt_cond_wait()
returns, it works fine.

static void sound_func(void *data)
{       
    rt_task_set_periodic(&sound_task, TM_NOW,
rt_timer_ns2ticks(ST_AUDIO_PERIOD));

    for (;;) //go until suspended or thread deletion
    { 
        if(!playing) {
            rt_mutex_acquire(&sound_mutex, TM_INFINITE);
            rt_cond_wait(&sound_cond, &sound_mutex, TM_INFINITE);
            rt_mutex_release(&sound_mutex);
        }
        
        rt_task_wait_period(0); //wait for next tick
    }
}

> -----Original Message-----
> From: Gilles Chanteperdrix [mailto:[EMAIL PROTECTED]
> Sent: Sunday, February 03, 2008 11:34 AM
> To: Steven Seeger
> Cc: [email protected]
> Subject: Re: [Xenomai-help] periodic task question
> 
> Steven Seeger wrote:
>  > If I want a periodic task to wait on a condition variable whose
purpose
>  > is to wait until the task is needed again, should I set it
non-periodic
>  > first and then set it periodic again after it wakes up?
>  >
>  >
>  >
>  > If I am running in periodic timebase mode, I notice weird behavior
>  > without this behavior. It seems ok in aperiodic mode, however.
> 
> Could you reduce your code to a minimal example showing this
behaviour?
> 
>  > Also, if I set the native skin to periodic mode, the latency
default
>  > setting of 4200 doesn't change tick types, therefore it causes all
my
>  > calls to rt_task_set_periodic() fail with jiffies less than this.
> 
> Try the attached patch. It looks like a condition got negated when
> replacing the test by a predicate.
> 
> --
> 
> 
>                                           Gilles Chanteperdrix.

_______________________________________________
Xenomai-help mailing list
[email protected]
https://mail.gna.org/listinfo/xenomai-help

Reply via email to