[1761] | 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 | |
---|
| 9 | namespace 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::launchRessourcesManager(isXiosServer) ; |
---|
| 22 | CXios::launchServicesManager(isXiosServer) ; |
---|
| 23 | CXios::launchContextsManager(isXiosServer) ; |
---|
[1878] | 24 | CXios::launchCouplerManager(isXiosServer) ; |
---|
| 25 | |
---|
[1761] | 26 | if (isXiosServer) CServer::launchServersRessource(splitComm) ; |
---|
| 27 | MPI_Comm_free(&splitComm) ; |
---|
| 28 | } |
---|
| 29 | |
---|
[1764] | 30 | CDaemonsManager::~CDaemonsManager() |
---|
| 31 | { |
---|
| 32 | CXios::finalizeContextsManager() ; |
---|
[1878] | 33 | CXios::finalizeCouplerManager() ; |
---|
[1764] | 34 | CXios::finalizeServicesManager() ; |
---|
| 35 | CXios::finalizeRessourcesManager() ; |
---|
| 36 | } |
---|
| 37 | |
---|
[1761] | 38 | bool CDaemonsManager::eventLoop(void) |
---|
| 39 | { |
---|
| 40 | CXios::getRessourcesManager()->eventLoop() ; |
---|
| 41 | CXios::getServicesManager()->eventLoop() ; |
---|
| 42 | CXios::getContextsManager()->eventLoop() ; |
---|
[1764] | 43 | if (isServer_) return CServer::getServersRessource()->eventLoop(false) ; |
---|
| 44 | else return CXios::getPoolRessource()->eventLoop(false) ; |
---|
[1761] | 45 | } |
---|
[1764] | 46 | |
---|
| 47 | bool CDaemonsManager::servicesEventLoop(void) |
---|
| 48 | { |
---|
| 49 | CXios::getRessourcesManager()->eventLoop() ; |
---|
| 50 | CXios::getServicesManager()->eventLoop() ; |
---|
| 51 | CXios::getContextsManager()->eventLoop() ; |
---|
| 52 | if (isServer_) return CServer::getServersRessource()->eventLoop(true) ; |
---|
| 53 | else return CXios::getPoolRessource()->eventLoop(true) ; |
---|
| 54 | } |
---|
[1761] | 55 | |
---|
| 56 | } |
---|