This is the mail archive of the
mailing list for the eCos project.
Sockets and synch primitive question
- From: Byron Jacquot <BJacquot at vestatech dot com>
- To: <ecos-discuss at sources dot redhat dot com>
- Date: Fri, 26 Sep 2008 14:35:34 -0600
- Subject: [ECOS] 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
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss