Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of libMiMic by
NyLPC_cHttpd.c
00001 #include "NyLPC_cHttpd_protected.h" 00002 00003 00004 NyLPC_TBool NyLPC_cHttpd_initialize(NyLPC_TcHttpd_t* i_inst,NyLPC_TUInt16 i_port_number) 00005 { 00006 int i; 00007 i_inst->_num_of_active_connection=0; 00008 NyLPC_cMutex_initialize(&i_inst->_mutex); 00009 i_inst->_listener=NyLPC_cNet_createTcpListenerEx(i_port_number); 00010 if(i_inst->_listener==NULL){ 00011 return NyLPC_TBool_FALSE; 00012 } 00013 for(i=0;i<NyLPC_cHttpd_NUMBER_OF_CONNECTION_THREAD;i++){ 00014 if(!NyLPC_cHttpdThread_initialize(&(i_inst->_thread[i]),i_inst,NyLPC_TcThread_PRIORITY_IDLE)){ 00015 return NyLPC_TBool_FALSE; 00016 } 00017 } 00018 return NyLPC_TBool_TRUE; 00019 } 00020 void NyLPC_cHttpd_finalize(NyLPC_TcHttpd_t* i_inst) 00021 { 00022 NyLPC_iTcpListener_finaize(i_inst->_listener); 00023 NyLPC_cMutex_finalize(&i_inst->_mutex); 00024 } 00025 00026 void NyLPC_cHttpd_loop(NyLPC_TcHttpd_t* i_inst) 00027 { 00028 int i; 00029 for(;;){ 00030 //ターミネイト状態のタスクを検索 00031 for(i=0;i<NyLPC_cHttpd_NUMBER_OF_CONNECTION_THREAD;i++){ 00032 NyLPC_cHttpdThread_start(&(i_inst->_thread[i]),i_inst->_listener); 00033 } 00034 NyLPC_cThread_yield(); 00035 } 00036 } 00037 00038 00039 00040 NyLPC_TUInt16 NyLPC_cHttpd_incNumOfConnection(NyLPC_TcHttpd_t* i_inst) 00041 { 00042 i_inst->_num_of_active_connection++; 00043 NyLPC_Assert(i_inst->_num_of_active_connection<=NyLPC_cHttpd_NUMBER_OF_CONNECTION_THREAD); 00044 return i_inst->_num_of_active_connection; 00045 } 00046 NyLPC_TUInt16 NyLPC_cHttpd_decNumOfConnection(NyLPC_TcHttpd_t* i_inst) 00047 { 00048 i_inst->_num_of_active_connection--; 00049 NyLPC_Assert(i_inst->_num_of_active_connection>=0); 00050 return i_inst->_num_of_active_connection; 00051 } 00052 00053 /** 00054 * Httpd全体で唯一のロックを取得する。 00055 */ 00056 void NyLPC_cHttpd_lock(NyLPC_TcHttpd_t* i_inst) 00057 { 00058 NyLPC_cMutex_lock(&i_inst->_mutex); 00059 } 00060 /** 00061 * Httpd全体で唯一のロックを開放する。 00062 */ 00063 void NyLPC_cHttpd_unlock(NyLPC_TcHttpd_t* i_inst) 00064 { 00065 NyLPC_cMutex_unlock(&i_inst->_mutex); 00066 }
Generated on Tue Jul 12 2022 16:22:57 by
1.7.2
