[ECOS] Calling cyg_mbox_trypost() from DSR

Bart Veer bartv@ecoscentric.com
Thu Apr 7 22:10:00 GMT 2005

>>>>> "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 @
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

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

More information about the Ecos-discuss mailing list