Comtrol eCos User Manual
Page 506

Chapter 37. Support Features
open-my-listen-sockets();
while ( 1 ) {
serve-one-request();
// sleeps if no connections, but not forever;
// so this loop is polled a few times a minute...
if ( cyg_semaphore_trywait( &dhcp_needs_attention )) {
if ( ! dhcp_bind() ) {
close-my-listen-sockets();
dhcp_halt();
break;
}
}
}
}
If the configuration option CYGOPT_NET_DHCP_DHCP_THREAD is defined, then eCos provides a
thread as described initially. Independent of this option, initialization of the interfaces still occurs in
init_all_network_interfaces()
and your startup code can call that. It will start the DHCP management
thread if configured. If a lease fails to be renewed, the management thread will shut down all interfaces and
attempt to initialize all the interfaces again from scratch. This may cause chaos in the app, which is why managing
the DHCP state in an application aware thread is actually better, just far less convenient for testing.
402