This is the mail archive of the
ecos-discuss@sourceware.org
mailing list for the eCos project.
Re: Synchronization primitive for DSRs
- From: Andrew Lunn <andrew at lunn dot ch>
- To: Stefan Sommerfeld <sommerfeld at mikrom dot de>
- Cc: ecos-discuss at ecos dot sourceware dot org
- Date: Thu, 30 Nov 2006 14:17:30 +0100
- Subject: Re: [ECOS] Synchronization primitive for DSRs
- References: <005901c71474$78eb0ae0$152ca8c0@nullnullsix>
On Thu, Nov 30, 2006 at 12:41:27PM +0100, Stefan Sommerfeld wrote:
> Hi there,
>
> I searching for a kind of mutex which also blocks a specific DSRs. Mutexes
> doesn't work within DSRs, so the only way to share resources which are used
> by a thread and a DSR is to use scheduler_lock() which blocks the whole
> system.
Take a look at
http://ecos.sourceware.org/docs-latest/ref/devapi-synchronization.html
It suggests to use cyg_drv_dsr_lock()/cyg_drv_dsr_unlock(). This
should, it think, leave the scheduler running. However, in RTOSs, most
things are triggered by ISR, which naturally post DSR, and if you have
DSRs locked, events are just going to get queued up and never actually
processed. So think about deadlocks, try not to make any blocking
calls while you have DSR locked etc...
Take a look at the serial device driver layers for examples of how to
use these locks.
Andrew
--
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss