public inbox for ecos-discuss@sourceware.org
 help / color / mirror / Atom feed
From: Robert Brusa <bob.brusa@gmail.com>
To: "Szentirmai Gergely" <gergely.szentirmai@axelero.hu>,
	"eCos Discuss"  <ecos-discuss@ecos.sourceware.org>
Subject: Re: [ECOS] Interrupt vs Thread - shared resource
Date: Thu, 12 Feb 2009 15:32:00 -0000	[thread overview]
Message-ID: <op.uo8v3br7keg3uf@localhost> (raw)
In-Reply-To: <4993822B.7010405@axelero.hu>

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

  parent reply	other threads:[~2009-02-12 15:32 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-02-12  1:58 Szentirmai Gergely
2009-02-12  2:10 ` Paul D. DeRocco
2009-02-12 15:32 ` Robert Brusa [this message]
2009-02-12 18:10   ` Szentirmai Gergely
2009-02-13  1:54     ` Paul D. DeRocco
2009-02-14 22:32       ` Reg
2009-02-14 23:26         ` Paul D. DeRocco
2009-02-15 10:50           ` Szentirmai Gergely

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=op.uo8v3br7keg3uf@localhost \
    --to=bob.brusa@gmail.com \
    --cc=ecos-discuss@ecos.sourceware.org \
    --cc=gergely.szentirmai@axelero.hu \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).