Ignore:
Timestamp:
08/29/23 17:24:04 (10 months ago)
Author:
ymipsl
Message:

Major update :

  • New method to lock and unlock one-sided windows (window_dynamic) to avoid network overhead
  • Introducing multithreading on server sided to manage more efficiently dead-lock occuring (similar to co-routine which will be available and implemented in futur c++ standard), based on c++ threads
  • Suprression of old "attached mode" which is replaced by online writer and reder filters

YM

File:
1 edited

Legend:

Unmodified
Added
Removed
  • XIOS3/trunk/src/manager/services.cpp

    r2523 r2547  
    55#include "server_context.hpp" 
    66#include "event_scheduler.hpp" 
     7#include "thread_manager.hpp" 
    78#include "timer.hpp" 
    89 
     
    4142    oss<<partitionId; 
    4243    name_= poolId+"__"+serviceId+"_"+oss.str(); 
     44     
     45    if (CThreadManager::isUsingThreads()) CThreadManager::spawnThread(&CService::threadEventLoop, this) ; 
    4346  } 
    4447 
     
    124127 
    125128    eventScheduler_->checkEvent() ; 
     129    
    126130    for(auto it=contexts_.begin();it!=contexts_.end();++it)  
    127131    { 
     
    134138      } ; 
    135139    } 
     140   
    136141    CTimer::get("CService::eventLoop").suspend(); 
    137142    if (contexts_.empty() && finalizeSignal_) return true ; 
    138143    else return false ; 
    139144  } 
     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 
    140187 
    141188  void CService::sendNotification(int rank) 
Note: See TracChangeset for help on using the changeset viewer.