This is the mail archive of the ecos-discuss@sources.redhat.com mailing list for the eCos project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Synchronization problem in IP stack




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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]