Explicitly shut down network driver.

This commit is contained in:
oliverschmidt 2007-05-22 21:19:34 +00:00
parent dab63c4c6b
commit a7dba4cc4f

View file

@ -29,10 +29,14 @@
* *
* This file is part of the Contiki OS * This file is part of the Contiki OS
* *
* $Id: contiki-main.c,v 1.6 2007/05/20 21:36:31 oliverschmidt Exp $ * $Id: contiki-main.c,v 1.7 2007/05/22 21:19:34 oliverschmidt Exp $
* *
*/ */
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include "contiki.h" #include "contiki.h"
#include "net/uip.h" #include "net/uip.h"
@ -48,6 +52,16 @@ PROCINIT(&etimer_process, &tcpip_process, &wpcap_process);
PROCINIT(&etimer_process, &tcpip_process, &tapdev_process); PROCINIT(&etimer_process, &tcpip_process, &tapdev_process);
#endif #endif
/*-----------------------------------------------------------------------------------*/
void
exit_handler(void)
{
#ifdef __CYGWIN__
process_post_synch(&wpcap_process, PROCESS_EVENT_EXIT, NULL);
#else
process_post_synch(&tapdev_process, PROCESS_EVENT_EXIT, NULL);
#endif
}
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
int int
main(void) main(void)
@ -69,6 +83,8 @@ main(void)
uip_ipaddr(&addr, 255,255,255,0); uip_ipaddr(&addr, 255,255,255,0);
uip_setnetmask(&addr); uip_setnetmask(&addr);
atexit(exit_handler);
while(1) { while(1) {
int n; int n;
n = process_run(); n = process_run();