[ECOS] drv_lock() cond_wait() drv_unlock() sequence

Gary Thomas gthomas@redhat.com
Tue Apr 4 16:15:00 GMT 2000


On 04-Apr-00 Grant Edwards wrote:
> 
>>From looking at the documentation it would appear that calling
> cyg_drv_dsr_lock() will prevent DSRs from running until
> cyg_drv_dsr_unlock() is called.  
> 
> But, after looking at the serial driver, this can't be the
> case, since it does a cyg_cond_wait() after locking out DSRs,
> and a DSR is what does a signal() to wake up the waiting task.
> 
> It does something like:
> 
>   cyg_drv_mutex_lock(&mtx)
>   cyg_drv_dsr_lock();
>   while (1)
>     {
>     if (done)
>        break;
>     else
>        cyg_drv_cond_wait(&cv);
>     }
>   cyg_drv_dsr_unlock();
>   cyg_drv_mutex_unlock(&mtx);  
> 
> The call to cyg_drv_cond_wait() must unlock DSRs or the whole
> system would just grind to a halt at that point.  When
> cyg_drv_cond_wait() returns, are DSRs again locked out until
> either cyg_drv_cond_wait()or cyg_drv_dsr_unlock() is called?
> 

cyg_drv_cond_wait() does an implicit scheduler unlock/relock sequence,
so the operation layout above does work.



More information about the Ecos-discuss mailing list