[ECOS] Interrupt vs Thread - shared resource

Robert Brusa bob.brusa@gmail.com
Thu Feb 12 15:32:00 GMT 2009


On Thu, 12 Feb 2009 02:58:03 +0100, Szentirmai Gergely  
<gergely.szentirmai@axelero.hu> wrote:

> Hello
>
> I describe my problem with a simplified example: I have a thread, which  
> works with a buffer, and an ISR (or DSR), which would add some byte to  
> this buffer too, so it is a shared resource. Since it is unable wait for  
> a flag, or mutex in ISR, when the thread's code working with the buffer,  
> the interrupt can jam the data.
> The only solution is to disable the interrupt for that critical section  
> in the thread? Isn't there a better solution?
>
> I hope I was clear.
>
> Thanks!
> Gergely Szentirmai
>
>
Well, you might block just this particular interrupt while messing around
in the DSR using cyg_drv_interrupt_mask(vector) and enable it after the
critical section using the correspoding unmask-routine. This would still  
allow other interrupts to come through.

When a "normal" task accesses critical data that are also accessed by a  
DSR use cyg_drv_dsr_lock() etc.....

Happy with this? Regards
    Robert


-- 
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss



More information about the Ecos-discuss mailing list