lwip-users
[Top][All Lists]
Advanced

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

[lwip-users] unix/sys_arch.c problem


From: Karl Jeacle
Subject: [lwip-users] unix/sys_arch.c problem
Date: Wed, 19 Nov 2003 11:03:21 +0000

Hi all,

I have run into a problem in unix/sys_arch.c that causes my application
to hang. With gdb, I can see exactly where the problem is, but I
don't understand why it is happening or the correct way to fix it.

The problem arises when sys_mbox reaches its maximum size.
sys_mbox_post() waits on line 229 for mbox->mail to be signaled.
This signal is sent on line 287 by sys_arch_mbox_fetch() when space
becomes available, but the signal does not appear to arrive, so
sys_mbox_post() remains blocked forever. (In fact, sys_arch_mbox_fetch()
sends this signal multiple times as it empties the mbox, but
sys_mbox_post() remains blocked.)

mbox->mail was originally used to signal a new message in the mbox,
but code comments describe a later change by James Roth that gives
it a second function of signaling when space becomes available in
a full mbox.

As I have no pthread experience, I tried introducing a new variable
mbox->mail2 to separate out these two uses, and to my surprise,
this actually works - or at least, appears to work most of the time
- if I make the mbox fill too often, it appears the signal doesn't
always get through. So my current solution to this problem is to
increase SYS_MBOX_SIZE and introduce mbox->mail2, but as I don't
know why this is working, I don't have much confidence in the
solution, and expect the problem to happen again.

Any advice/pointers appreciated!

Thanks,
Karl




reply via email to

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