public inbox for ecos-discuss@sourceware.org
 help / color / mirror / Atom feed
* [ECOS] mbox, ISR and DSR...
@ 2000-11-27 15:38 Fabrice Gautier
  2000-11-28  0:09 ` Andrew Lunn
  0 siblings, 1 reply; 3+ messages in thread
From: Fabrice Gautier @ 2000-11-27 15:38 UTC (permalink / raw)
  To: Ecos-List (E-mail)

Hi,

Is it safe to use mbox function in an ISR? and in a DSR?

There is no mention of the mbox functions in the table at:
http://sources.redhat.com/ecos/docs-latest/ref/ecos-ref.13.html#pgfId=108056
9


Thanks
-- 
Fabrice Gautier
fabrice_gautier@sdesigns.com 

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [ECOS] mbox, ISR and DSR...
  2000-11-27 15:38 [ECOS] mbox, ISR and DSR Fabrice Gautier
@ 2000-11-28  0:09 ` Andrew Lunn
  2000-11-28  7:00   ` Hugo Tyson
  0 siblings, 1 reply; 3+ messages in thread
From: Andrew Lunn @ 2000-11-28  0:09 UTC (permalink / raw)
  To: Fabrice Gautier; +Cc: Ecos-List (E-mail)

> Hi,
> 
> Is it safe to use mbox function in an ISR? and in a DSR?

I've used cyg_mbox_tryput() in a DSR. Its worked so far. It seems a
genaral rule of thumb is you can use anything that does not block in a
DSR. 

        Andrew

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [ECOS] mbox, ISR and DSR...
  2000-11-28  0:09 ` Andrew Lunn
@ 2000-11-28  7:00   ` Hugo Tyson
  0 siblings, 0 replies; 3+ messages in thread
From: Hugo Tyson @ 2000-11-28  7:00 UTC (permalink / raw)
  To: ecos-discuss


Andrew Lunn <andrew.lunn@ascom.ch> writes:

> > Hi,
> > 
> > Is it safe to use mbox function in an ISR? and in a DSR?
> 
> I've used cyg_mbox_tryput() in a DSR. Its worked so far. It seems a
> genaral rule of thumb is you can use anything that does not block in a
> DSR. 

Absolutely right.

The reason we have ISRs and DSRs is to allow exactly that:

 o ISRs are called right now regardless of kernel state, therefore you
   cannot do calls into the kernel from an ISR.
 o DSRs are called (when requested) as soon as possible after the
   associated ISR, when the kernel state is such that it's safe to call
   into the kernel.

A DSR still cannot sleep, because it is not a thread context; only threads
can sleep.  Therefore only operations which cannot block may be called from
a DSR.

For example, Andrew says cyg_mbox_tryput() is OK.  Correct.  But
cyg_mbox_put() is NOT OK because it can block if the queue is full.

NB eCos does not (cannot) police this very well; you don't necessarily get
a neat assertion failure if you do call any old thing from an ISR, or if
you call sleep() from a DSR.  Your app will go wrong, that's all; if it
appears to work, it's not working the way you think ;-) Just don't do it.

	- Huge

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2000-11-28  7:00 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2000-11-27 15:38 [ECOS] mbox, ISR and DSR Fabrice Gautier
2000-11-28  0:09 ` Andrew Lunn
2000-11-28  7:00   ` Hugo Tyson

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).