Mike_d

httpd_server_run(server): How to Stop the task

Discussion created by Mike_d on Dec 2, 2009
Latest reply on May 2, 2012 by dspNeil

The TCP/IP task ends up with an "Invalid Task ID" error code when I stop the httpd server task using the code below. I also can't uninstall the tfs driver.  Can someone please tell me how I can gracefully shut down these services and bring them back up?

 

The Task:

void httpd_task(uint_32 initial_data)
{
 uint_32 error;


 HTTPD_STRUCT *server;
 extern const HTTPD_CGI_LINK_STRUCT cgi_lnk_tbl[];
 extern const HTTPD_FN_LINK_STRUCT fn_lnk_tbl[];
 extern const TFS_DIR_ENTRY tfs_data[];

 if ((error = _io_tfs_install("tfs:", tfs_data))) {
     printf("\ninstall returned: %08x\n", error);
 }

 server = httpd_server_init((HTTPD_ROOT_DIR_STRUCT*)root_dir, "\\index.html");
 HTTPD_SET_PARAM_CGI_TBL(server, (HTTPD_CGI_LINK_STRUCT*)cgi_lnk_tbl);
 //HTTPD_SET_PARAM_FN_TBL(server, (HTTPD_FN_LINK_STRUCT*)fn_lnk_tbl);

 httpd_server_run(server);
 _task_block();
 
 //This poll mode doesn't work
 //while(1)
 // httpd_server_poll(server, 1);
 
}

 

 

 

Killing the Task: 

   task_id = _task_get_id_from_name("httpd server");
   _task_abort(task_id);

   if((error = _io_tfs_uninstall("tfs:")))
       printf("\ntfs uninstall returned: %08x\n", error);
   
   task_id = _task_get_id_from_name("httpd task");
   _task_abort(task_id);

Message Edited by Mike_d on 2009-12-02 04:57 PM

Outcomes