source: XIOS/dev/dev_ym/XIOS_COUPLING/src/manager/daemons_manager.cpp @ 2209

Last change on this file since 2209 was 2209, checked in by ymipsl, 3 years ago

Revisiting registry management and make it working.
YM

  • Property svn:eol-style set to native
  • Property svn:executable set to *
File size: 1.8 KB
Line 
1#include "daemons_manager.hpp"
2#include "cxios.hpp"
3#include "ressources_manager.hpp"
4#include "services_manager.hpp"
5#include "contexts_manager.hpp"
6#include "servers_ressource.hpp"
7#include "server.hpp"
8
9namespace xios
10{
11  using namespace std ;
12
13  CDaemonsManager::CDaemonsManager(bool isXiosServer) : isServer_(isXiosServer)
14  {
15    MPI_Comm xiosComm = CXios::getXiosComm() ;
16    int commRank ;
17    MPI_Comm_rank(xiosComm,&commRank) ;
18    MPI_Comm splitComm ;
19    MPI_Comm_split(xiosComm,isXiosServer,commRank,&splitComm) ;
20   
21    CXios::launchRegistryManager(isXiosServer) ;
22    CXios::launchRessourcesManager(isXiosServer) ;
23    CXios::launchServicesManager(isXiosServer) ;
24    CXios::launchContextsManager(isXiosServer) ;
25    CXios::launchCouplerManager(isXiosServer) ;
26 
27    if (isXiosServer) CServer::launchServersRessource(splitComm) ;
28    MPI_Barrier(xiosComm) ;
29    MPI_Comm_free(&splitComm) ;
30  }
31
32  CDaemonsManager::~CDaemonsManager()
33  {
34    CXios::finalizeContextsManager() ;
35    CXios::finalizeCouplerManager() ;
36    CXios::finalizeServicesManager() ;
37    CXios::finalizeRessourcesManager() ;
38    CXios::finalizeRegistryManager() ;
39  }
40
41  bool CDaemonsManager::eventLoop(void)
42  {
43    CXios::getRessourcesManager()->eventLoop() ;
44    CXios::getServicesManager()->eventLoop() ;
45    CXios::getContextsManager()->eventLoop() ;
46    if (isServer_) return CServer::getServersRessource()->eventLoop(false) ;
47    else  return CXios::getPoolRessource()->eventLoop(false) ;
48  }
49 
50  bool CDaemonsManager::servicesEventLoop(void)
51  {
52    CXios::getRessourcesManager()->eventLoop() ;
53    CXios::getServicesManager()->eventLoop() ;
54    CXios::getContextsManager()->eventLoop() ;
55    if (isServer_) return CServer::getServersRessource()->eventLoop(true) ;
56    else  return CXios::getPoolRessource()->eventLoop(true) ;
57  } 
58
59}
Note: See TracBrowser for help on using the repository browser.