void nasd_start(void) { int wait_time = 1 * 100; /* 1 second */ if (!_nas_pid || !oslib_waitpid(_nas_pid, NULL)) { cyg_thread_create(7, (cyg_thread_entry_t *)nas_main, (cyg_addrword_t)NULL, "NAS", (void *)nas_main_stack, sizeof(nas_main_stack), &nas_main_hdl, &nas_thread); cyg_thread_resume(nas_main_hdl); /* Make sure nas stared and initial completed. Otherwise, * it may lost some wireless driver events. */ while (_nas_ready == 0 && wait_time > 0) { cyg_thread_delay(10); wait_time -= 10; } NASMSG("NAS task started\n"); } }
void nasd_stop(void) { if (_nas_pid) { hup_hdlr(15 /* SIGTERM */); /* wait until not running */ while (oslib_waitpid(_nas_pid, NULL)) cyg_thread_delay(10); _nas_pid = 0; NASMSG("NAS task stopped\n"); } }
void eapd_stop(void) { if (_eapd_pid) { /* set stop flag */ eapd_hup_hdlr(0); /* wait till the eapd_main task is dead */ while (oslib_waitpid(_eapd_pid, NULL)) cyg_thread_delay(10); _eapd_pid = 0; EAPD_PRINT("EAPD task stopped\n"); } }
/* Terminate IGD */ void igd_stop(void) { int pid; igd_stop_handler(); /* Wait until thread exit */ pid = oslib_getpidbyname("IGD"); if (pid) { while (oslib_waitpid(pid, NULL) != 0) cyg_thread_delay(1); } return; }
void eapd_start(void) { if (!_eapd_pid || !oslib_waitpid(_eapd_pid, NULL)) { cyg_thread_create(7, (cyg_thread_entry_t *)eapd_main, (cyg_addrword_t)NULL, "EAPD", eapd_main_stack, sizeof(eapd_main_stack), &eapd_main_hdl, &eapd_thread); cyg_thread_resume(eapd_main_hdl); EAPD_PRINT("EAPD task started\n"); } }