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