This is the mail archive of the ecos-discuss@sources.redhat.com 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: Calling cyg_mbox_trypost() from DSR


>>>>> "Frank" == Frank Pagliughi <fpagliughi@mindspring.com> writes:

    Frank> Is it safe to call cyg_mbox_trypost() from a DSR? There's
    Frank> some differing info in various documents, but I've seen it
    Frank> on this mailing list as a solution for several different
    Frank> problems.

    Frank> It appears to use Cyg_Scheduler::lock() for
    Frank> synchronization. Is that safe from a DSR? What if two DSR's
    Frank> are posting to the same mbox? Could they interrupt each
    Frank> other, or are DSR's serialized?

I assume you mean cyg_mbox_tryput(). See the last sentence @
http://ecos.sourceware.org/docs-latest/ref/kernel-mail-boxes.html
That is the authorative documentation, and explicitly lists
cyg_mbox_tryput() as callable from a DSR.

DSRs are serialized via the scheduler lock, that is what allows them
to manipulate kernel data structures without worrying about context
switches at an inconvenient moment. The scheduler is already locked on
entry to the DSR, and the call to Cyg_Scheduler::lock() just
increments a counter. Of course tryput() can also be called from
thread context, in which case locking the scheduler would be
essential.

The main problem with calling tryput() from a DSR is how to recover
when the tryput() fails. Presumably the DSR is trying to communicate
an event and some data to a thread. Some applications can cope if this
data is just discarded, but not all.

Bart

-- 
Bart Veer                       eCos Configuration Architect
http://www.ecoscentric.com/     The eCos and RedBoot experts


-- 
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]