This is the mail archive of the ecos-discuss@sourceware.org mailing list for the eCos project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

RE: I call cyg_mbox_get in DSR, System corrupt.


> > redheart wrote:
> >
> > I firstly called cyg_mbox_get in DSR, and block certain 
> > thread then i 
> > called cyg_mbox_put in another thread, then the scheduler 
> > attempt to 
> > wake up the blocked thread but at the time of switching 
> > context, the 
> > system corrupt.
> > 
> > the debugger show that "previus frame inner to this frame (corrupt 
> > stack?)"
> > I know that call blockable function in a DSR is illegal.
> > but i don'r know what resulted in the corrupt.
> > 
> > why?
> 
> From: Gary Thomas
> 
> Because this is an unsafe operation and "not allowed" to
> be called from a DSR.  DSRs cannot call any kernel function 
> which might block (because they are run anonymously, not in 
> any particular thread context).

You can, however, use the cyg_mbox_tryget operation in DSR context. I could
imagine using a mailbox to pass info to the DSR, by having the thread that
sends to the mailbox enable the appropriate interrupt, and then having the
DSR disable the interrupt if it detects an empty mailbox. However, I think
it's easier just to use a condition variable and a mutex and design one's
own FIFO mechanism.

-- 

Ciao,               Paul D. DeRocco
Paul                mailto:pderocco@ix.netcom.com


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]