deadlock from spinlock waiting..
gadia at usc.edu
Sat Aug 22 14:56:05 UTC 2015
As per your case task A has the lock and task B will be waiting for the
lock. Firstly as per your contex, I take that you are running querying
about uniprocessor targets. So in CORE_spinlock_Wait routine if the lock is
not available and if provide no timeout for this routing then its true that
this thread will spin indefinitely until it gets the lock. But main
question how will it get lock if it disables dispatches and interrupts. I
guess your going in right direction. But while waiting for the lock it
performs following things: from corespinlockwait.c
_ISR_Enable( level );
/* An ISR could occur here */
/* Another thread could get dispatched here */
/* Reenter the critical sections so we can attempt the lock again. */
_ISR_Disable( level );
So while waiting it gives up the processor periodically if lock is not
available. Hope this helps.
On Fri, Aug 21, 2015 at 11:18 PM, Chan Kim <ckim at etri.re.kr> wrote:
> This is a very basic question and I guess something's wrong in my
> I'm trying to use spinlock but not sure if it's working as I intend to use
> it for.
> The _CORE_spinlock_Wait function seems to be disabling interrupt. the code
> brief say even task dispatch is disabled.
> Then when task A already has the lock, and task B tries to get the lock,
> how can task A release it if it is not dispatched?
> My case right now seems like that. (write task waiting for the lock, but
> read task has the lock and because interrupt is disabled, read task cannot
> process things..)
> I'm uinsg version 4.10.99.
> users mailing list
> users at rtems.org
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the devel