Changeset 2547 for XIOS3/trunk/src/manager/services.cpp
- Timestamp:
- 08/29/23 17:24:04 (10 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
XIOS3/trunk/src/manager/services.cpp
r2523 r2547 5 5 #include "server_context.hpp" 6 6 #include "event_scheduler.hpp" 7 #include "thread_manager.hpp" 7 8 #include "timer.hpp" 8 9 … … 41 42 oss<<partitionId; 42 43 name_= poolId+"__"+serviceId+"_"+oss.str(); 44 45 if (CThreadManager::isUsingThreads()) CThreadManager::spawnThread(&CService::threadEventLoop, this) ; 43 46 } 44 47 … … 124 127 125 128 eventScheduler_->checkEvent() ; 129 126 130 for(auto it=contexts_.begin();it!=contexts_.end();++it) 127 131 { … … 134 138 } ; 135 139 } 140 136 141 CTimer::get("CService::eventLoop").suspend(); 137 142 if (contexts_.empty() && finalizeSignal_) return true ; 138 143 else return false ; 139 144 } 145 146 void CService::threadEventLoop(void) 147 { 148 info(100)<<"Launch Thread for CService::threadEventLoop, service id = "<<name_<<endl ; 149 CThreadManager::threadInitialize() ; 150 151 do 152 { 153 CTimer::get("CService::eventLoop").resume(); 154 int flag ; 155 MPI_Iprobe(MPI_ANY_SOURCE, MPI_ANY_TAG, MPI_COMM_WORLD, &flag, MPI_STATUS_IGNORE); 156 157 // double time=MPI_Wtime() ; 158 // if (time-lastEventLoop_ > eventLoopLatency_) 159 // { 160 checkNotifications() ; 161 // lastEventLoop_=time ; 162 // } 163 164 165 eventScheduler_->checkEvent() ; 166 167 for(auto it=contexts_.begin();it!=contexts_.end();++it) 168 { 169 if (it->second->isFinished()) 170 { 171 delete it->second ; 172 contexts_.erase(it) ; 173 // destroy server_context -> to do later 174 break ; 175 } ; 176 } 177 178 CTimer::get("CService::eventLoop").suspend(); 179 if (contexts_.empty() && finalizeSignal_) finished_=true ; 180 if (!finished_) CThreadManager::yield() ; 181 } while (!finished_) ; 182 183 CThreadManager::threadFinalize() ; 184 info(100)<<"Close thread for CService::threadEventLoop, service id = "<<name_<<endl ; 185 } 186 140 187 141 188 void CService::sendNotification(int rank)
Note: See TracChangeset
for help on using the changeset viewer.