lwip-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[lwip-devel] [bug #23408] Deadlock on sys_mbox_post sys_mbox_fetch


From: Kieran Mansley
Subject: [lwip-devel] [bug #23408] Deadlock on sys_mbox_post sys_mbox_fetch
Date: Fri, 30 May 2008 11:10:15 +0000
User-agent: Opera/9.21 (X11; Linux i686; U; en)

Follow-up Comment #9, bug #23408 (project lwip):

OK, I think I understand.  Here is what I think, please correct me if I'm
wrong:

1) Something calls sys_arch_mbox_fetch(), but the mailbox is empty, so it
drops the mutex and it is about to wait for the mail semaphore to be signalled
when it is interrupted by...

2) Something calls sys_mbox_post().  This puts something in the mailbox and
because it was empty signals the mail semaphore.  If (1) had succeeded in
getting to the point where it waits on the mail semaphore, it would have then
be woken up to get that message.

3) sys_mbox_post() is then called a lot, until the mailbox is full, and it
also goes to wait on the mail semaphore.  As it earlier signalled this (when
it put the first message in) it will immediately wake, but then wait on the
semaphore again as the condition it's waiting for has not been met.  In doing
so it consumes the signal that should have gone to sys_arch_mbox_fetch()

4) sys_arch_mbox_fetch() is then re-scheduled and goes to wait on the mail
semaphore.  The signal that should have woken it has been consumed by the
posting thread, and so it blocks even though the mailbox now has things in to
read.

Hence deadlock.

    _______________________________________________________

Reply to this item at:

  <http://savannah.nongnu.org/bugs/?23408>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.nongnu.org/





reply via email to

[Prev in Thread] Current Thread [Next in Thread]