<div dir="ltr">Please check the timeout value passed to wait() for write task. This is the only thing I can think of. otherwise the read task should proceed.<br></div><div class="gmail_extra"><br clear="all"><div><div class="gmail_signature"><div dir="ltr">Thanks,<div><br></div><div>Saurabh Gadia</div></div></div></div>
<br><div class="gmail_quote">On Sun, Aug 23, 2015 at 2:23 AM, 김찬 <span dir="ltr"><<a href="mailto:ckim@etri.re.kr" target="_blank">ckim@etri.re.kr</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div>
<div style="FONT-SIZE:10pt;FONT-FAMILY:굴림">
<div>
<div>
<div style="LINE-HEIGHT:15pt"><br>
<br>
<div>Hi, Saurabh,</div>
<div>Thank you for letting me know that. I didn't see the code inside the wait function thourougly.</div>
<div>But my case is still read task holding it and write task waiting for it. There must be some other cause for this I guess.</div>
<div>Thanks!</div>
<div> </div>
<div>Chan<br>
</div>
<div>
<hr>
<b>보낸 사람 : </b>"Saurabh Gadia" <<a href="mailto:gadia@usc.edu" target="_blank">gadia@usc.edu</a>><br>
<b>보낸 날짜 : </b>2015-08-23 00:00:55 ( +09:00 )<br>
<b>받는 사람 : </b>김찬 <<a href="mailto:ckim@etri.re.kr" target="_blank">ckim@etri.re.kr</a>>, <a href="mailto:users@rtems.org" target="_blank">users@rtems.org</a> <<a href="mailto:users@rtems.org" target="_blank">users@rtems.org</a>><br>
<b>참조 : </b><br>
<b>제목 : </b>Re: deadlock from spinlock waiting..<div><div class="h5"><br>
<br>
<div dir="ltr">Ohh, lots of typos. Sorry for that.<br>
<br>
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 uniprocessor targets. So in CORE_spinlock_Wait routine if the lock is not available and if no timeout is providedthen its true
that this thread will spin indefinitely until it gets the lock. But main question is 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<br>
<br>
for(;;)<br>
{ <br>
...<br>
...<br>
_ISR_Enable( level );<br>
/* An ISR could occur here */<br>
<br>
_Thread_Enable_dispatch();<br>
/* Another thread could get dispatched here */<br>
<br>
/* Reenter the critical sections so we can attempt the lock again. */<br>
_Thread_Disable_dispatch();<br>
<br>
_ISR_Disable( level );<br>
}<br>
<br>
So while waiting task B(write task) gives up the processor periodically if lock is not available. So this way your read task will get the control from scheduler after write task relinquishes the CPU. Hope this helps.<br>
<br>
</div>
<div class="gmail_extra"><br clear="all">
<div>
<div>
<div dir="ltr">Thanks,
<div><br>
</div>
<div>Saurabh Gadia</div>
</div>
</div>
</div>
<br>
<div class="gmail_quote">On Sat, Aug 22, 2015 at 7:56 AM, Saurabh Gadia <span dir="ltr">
<<a href="mailto:gadia@usc.edu" target="_blank">gadia@usc.edu</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="PADDING-LEFT:1ex;MARGIN:0px 0px 0px 0.8ex;BORDER-LEFT:#ccc 1px solid">
<div dir="ltr">
<div>
<div>Hi Kim,<br>
<br>
</div>
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<br>
<br>
</div>
for(;;)<br>
{ <br>
...<br>
...<br>
_ISR_Enable( level );<br>
/* An ISR could occur here */<br>
<br>
_Thread_Enable_dispatch();<br>
/* Another thread could get dispatched here */<br>
<br>
/* Reenter the critical sections so we can attempt the lock again. */<br>
_Thread_Disable_dispatch();<br>
<br>
_ISR_Disable( level );<br>
}<br>
<div><br>
<div class="gmail_extra"> So while waiting it gives up the processor periodically if lock is not available. Hope this helps.<br>
<br clear="all">
</div>
<div class="gmail_extra">
<div>
<div>
<div dir="ltr">Thanks,
<div><br>
</div>
<div>Saurabh Gadia</div>
</div>
</div>
</div>
<div>
<div><br>
<div class="gmail_quote">On Fri, Aug 21, 2015 at 11:18 PM, Chan Kim <span dir="ltr">
<<a href="mailto:ckim@etri.re.kr" target="_blank">ckim@etri.re.kr</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="PADDING-LEFT:1ex;MARGIN:0px 0px 0px 0.8ex;BORDER-LEFT:rgb(204,204,204) 1px solid">
Hello,<br>
This is a very basic question and I guess something's wrong in my understanding.<br>
I'm trying to use spinlock but not sure if it's working as I intend to use it for.<br>
The _CORE_spinlock_Wait function seems to be disabling interrupt. the code brief say even task dispatch is disabled.<br>
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?<br>
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..)<br>
I'm uinsg version 4.10.99.<br>
Chan<br>
_______________________________________________<br>
users mailing list<br>
<a href="mailto:users@rtems.org" target="_blank">users@rtems.org</a><br>
<a href="http://lists.rtems.org/mailman/listinfo/users" rel="noreferrer" target="_blank">http://lists.rtems.org/mailman/listinfo/users</a><br>
</blockquote>
</div>
<br>
</div>
</div>
</div>
</div>
</div>
</blockquote>
</div>
<br>
</div>
</div></div></div>
</div>
</div>
</div>
</div>
</div>
</blockquote></div><br></div>