This is the mail archive of the 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]
Other format: [Raw text]

Sockets and synch primitive question

I'm working on an application that includes a sporadically connected
Ethernet server - a portable device that's used standalone most of the
time, but is occasionally returned to the home base, where it may be
connected for data downlaoding.  It's implemented with two threads.

The first thread polls the "LinkOK" bit in a Cirrus CS8900a.  When the
link is OK, it spawns the second thread, which initializes the interface
and acts as a TCP server.

When the LinkOK bit disappears, the first thread notifies the stack by
clearing the IFF_UP bit.  The second thread (usually blocked in an
accept() or read() call) gets a status of "operation interrupted" and
cleans up its active resources.  I've got all of this working, and it's
no longer leaking file descriptors.  

However, getting the server thread to wake up when the interface goes
down requires that the first thread call cyg_thread_release().  Can
anyone explain why it requires this extra kick?  Shouldn't the ioctl
removing IFF_UP give the stack sufficient stimulus to unblock the

Thank you,

Byron Jacquot

Before posting, please read the FAQ:
and search the list archive:

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