This is the mail archive of the
ecos-discuss@sources.redhat.com
mailing list for the eCos project.
Synchronization problem in IP stack
- To: ecos-discuss at sources dot redhat dot com
- Subject: [ECOS] Synchronization problem in IP stack
- From: "Wade Jensen" <Wade_Jensen at inter-tel dot com>
- Date: Wed, 12 Sep 2001 13:26:03 -0700
Hello,
I was running into a rare problem when two threads attempted to send on the same
TCP socket. There is a race condition in the sblock() routine that sometimes
causes one of the threads to never wake up.
I believe the following patch fixes this problem. I was able to reproduce it
very quickly, so I am fairly confident that this fixes the problem.
What this patch fixes:
1. I noticed that there are many places in the IP stack that use #ifdef __ECOS
or #ifdef __ECOS__, but the __ECOS__ label was not defined in the compiler
options. Because of this, a call to sblock() was using the macro rather than
the function call.
2. The sblock() function was incorrectly assuming that sb_lock() unlocked the
scheduler.
3. There was an unnecessary assertion in cyg_tsleep().
Please let me know if this is incorrect.
Thanks,
Wade Jensen
(See attached file: patch.sblock)
patch.sblock