Index: XIOS3/trunk/src/client.cpp
===================================================================
--- XIOS3/trunk/src/client.cpp	(revision 2522)
+++ XIOS3/trunk/src/client.cpp	(revision 2523)
@@ -188,5 +188,6 @@
      
       CXios::launchDaemonsManager(false) ;
-      poolRessource_ = new CPoolRessource(clientComm, codeId, false) ;
+      shared_ptr<CEventScheduler> eventScheduler ;
+      poolRessource_ = new CPoolRessource(clientComm, eventScheduler, codeId, false) ;
 
       /////////////////////////////////////////
@@ -196,5 +197,5 @@
       MPI_Request req ;
       MPI_Status status ;
-      MPI_Ibarrier(xiosGlobalComm,&req) ; // be sure that all services are created now, could be remove later if more asynchronisity
+      MPI_Ibarrier(CXios::getXiosComm(),&req) ; // be sure that all services are created now, could be remove later if more asynchronisity
       int ok=false ;
       while (!ok)
@@ -443,8 +444,12 @@
       MPI_Comm_rank(contextComm,&commRank) ;
       MPI_Comm_size(contextComm,&commSize) ;
-
-      getPoolRessource()->createService(contextComm, id, 0, CServicesManager::CLIENT, 1) ;
-      getPoolRessource()->createService(contextComm, id+"_"+CXios::defaultWriterId, 0, CServicesManager::WRITER, 1) ;
-      getPoolRessource()->createService(contextComm, id+"_"+CXios::defaultReaderId, 0, CServicesManager::READER, 1) ;
+      
+      shared_ptr<CEventScheduler> eventScheduler ;
+      
+      getPoolRessource()->createService(contextComm, eventScheduler, id, 0, CServicesManager::CLIENT, 1) ;
+//      getPoolRessource()->createService(contextComm, eventScheduler, id+"_"+CXios::defaultWriterId, 0, CServicesManager::WRITER, 1) ;
+      getPoolRessource()->createNewServiceOnto(id+"_"+CXios::defaultWriterId, CServicesManager::WRITER, id) ;
+//      getPoolRessource()->createService(contextComm, eventScheduler, id+"_"+CXios::defaultReaderId, 0, CServicesManager::READER, 1) ;
+      getPoolRessource()->createNewServiceOnto(id+"_"+CXios::defaultReaderId, CServicesManager::READER, id) ;
 
       if (commRank==0) while (!CXios::getServicesManager()->hasService(getPoolRessource()->getId(), id, 0)) { CXios::getDaemonsManager()->eventLoop();}
Index: XIOS3/trunk/src/manager/contexts_manager.hpp
===================================================================
--- XIOS3/trunk/src/manager/contexts_manager.hpp	(revision 2522)
+++ XIOS3/trunk/src/manager/contexts_manager.hpp	(revision 2523)
@@ -75,5 +75,5 @@
     MPI_Comm xiosComm_ ;
 
-    int notifyType_ ;
+    int notifyType_ = NOTIFY_NOTHING ;
     tuple<std::string, std::string, int, std::string> notifyCreateContext_ ;
     tuple<std::string, std::string, int, std::string, int, std::string> notifyCreateIntercomm_ ;
Index: XIOS3/trunk/src/manager/pool_ressource.cpp
===================================================================
--- XIOS3/trunk/src/manager/pool_ressource.cpp	(revision 2522)
+++ XIOS3/trunk/src/manager/pool_ressource.cpp	(revision 2523)
@@ -7,8 +7,9 @@
 #include "cxios.hpp"
 #include "timer.hpp"
+#include "event_scheduler.hpp"
 
 namespace xios
 {
-  CPoolRessource::CPoolRessource(MPI_Comm poolComm, const std::string& Id, bool isServer) : Id_(Id), finalizeSignal_(false)
+  CPoolRessource::CPoolRessource(MPI_Comm poolComm, shared_ptr<CEventScheduler> eventScheduler, const std::string& Id, bool isServer) : Id_(Id), finalizeSignal_(false)
   {
     int commRank, commSize ;
@@ -29,4 +30,7 @@
     winNotify_->updateToExclusiveWindow(commRank, this, &CPoolRessource::notificationsDumpOut) ;
     MPI_Barrier(poolComm_) ;
+    if (eventScheduler) eventScheduler_=eventScheduler ;
+    else eventScheduler_= make_shared<CEventScheduler>(poolComm) ;
+    freeRessourceEventScheduler_ = eventScheduler_ ;
   }
 
@@ -36,4 +40,9 @@
     
     auto it=occupancy_.begin() ;
+
+    // ym obsolete, service cannot overlap, only created on separate ressource or matching excatly existing service
+    // occupancy management must not be used anymore => simplification
+    // for now raise a message error when no ressources are availables
+    
     int commSize ;
     MPI_Comm_size(poolComm_, &commSize) ;
@@ -43,9 +52,12 @@
     for(int i=0; i<size; i++) 
     {
+      if (it->first != 0) ERROR("void CPoolRessource::createService(const std::string& serviceId, int type, int size, int nbPartitions)",
+                                 << "No enough free ressources on pool id="<<getId()<<" to launch service id="<<serviceId);
       procs_in[it->second]=true ;
       procs_update.push_back(std::pair<int,int>(it->first+1,it->second)) ;
       ++it ;
     }
-    
+
+
     occupancy_.erase(occupancy_.begin(),it) ;
     occupancy_.insert(procs_update.begin(),procs_update.end()) ;
@@ -247,39 +259,67 @@
   {
      
-     info(40)<<"CPoolRessource::createNewService  : receive createService notification ; serviceId : "<<serviceId<<endl ;
-     MPI_Comm serviceComm, newServiceComm ;
-     int commRank ;
-     MPI_Comm_rank(poolComm_,&commRank) ;
-     MPI_Comm_split(poolComm_, in, commRank, &serviceComm) ;
-     if (in)
-     {
-       int serviceCommSize ;
-       int serviceCommRank ;
-       MPI_Comm_size(serviceComm,&serviceCommSize) ;
-       MPI_Comm_rank(serviceComm,&serviceCommRank) ;
-
-       info(10)<<"Service  "<<serviceId<<" created "<<"  service size : "<<serviceCommSize<< "   service rank : "<<serviceCommRank 
-                            <<" on rank pool "<<commRank<<endl ;
+    info(40)<<"CPoolRessource::createNewService  : receive createService notification ; serviceId : "<<serviceId<<endl ;
+    MPI_Comm serviceComm, newServiceComm, freeComm ;
+    int commRank ;
+     
+    int color;
+    if (!services_.empty()) color = 0 ;
+    else color=1 ; 
+    MPI_Comm_rank(poolComm_,&commRank) ;
+    MPI_Comm_split(poolComm_, color, commRank, &freeComm) ;  // workaround
+    
+    if (services_.empty()) 
+    {
+      MPI_Comm_rank(freeComm,&commRank) ;
+      MPI_Comm_split(freeComm, in, commRank, &serviceComm) ;
+
+      // temporary for event scheduler, we must using hierarchical split of free ressources communicator.
+      // we hope for now that spliting using occupancy make this match
+
+      if (in)
+      {
+        int serviceCommSize ;
+        int serviceCommRank ;
+        MPI_Comm_size(serviceComm,&serviceCommSize) ;
+        MPI_Comm_rank(serviceComm,&serviceCommRank) ;
+
+        info(10)<<"Service  "<<serviceId<<" created "<<"  service size : "<<serviceCommSize<< "   service rank : "<<serviceCommRank 
+                              <<" on rank pool "<<commRank<<endl ;
        
-       int partitionId ; 
-       if ( serviceCommRank >= (serviceCommSize/nbPartitions+1)*(serviceCommSize%nbPartitions) )
-       {
-         int rank =  serviceCommRank - (serviceCommSize/nbPartitions+1)*(serviceCommSize%nbPartitions) ;
-         partitionId = serviceCommSize%nbPartitions +  rank / (serviceCommSize/nbPartitions) ;
-       }
-       else  partitionId = serviceCommRank / (serviceCommSize/nbPartitions + 1) ;
-
-       MPI_Comm_split(serviceComm, partitionId, commRank, &newServiceComm) ;
+        int partitionId ; 
+        if ( serviceCommRank >= (serviceCommSize/nbPartitions+1)*(serviceCommSize%nbPartitions) )
+        {
+          int rank =  serviceCommRank - (serviceCommSize/nbPartitions+1)*(serviceCommSize%nbPartitions) ;
+          partitionId = serviceCommSize%nbPartitions +  rank / (serviceCommSize/nbPartitions) ;
+        }
+        else  partitionId = serviceCommRank / (serviceCommSize/nbPartitions + 1) ;
+
+        MPI_Comm_split(serviceComm, partitionId, commRank, &newServiceComm) ;
+
+        MPI_Comm_size(newServiceComm,&serviceCommSize) ;
+        MPI_Comm_rank(newServiceComm,&serviceCommRank) ;
+        info(10)<<"Service  "<<serviceId<<" created "<<"  partition : " <<partitionId<<" service size : "<<serviceCommSize
+                << " service rank : "<<serviceCommRank <<" on rank pool "<<commRank<<endl ;
+      
+        shared_ptr<CEventScheduler> parentScheduler, childScheduler ;
+        freeRessourceEventScheduler_->splitScheduler(newServiceComm, parentScheduler, childScheduler) ;
+        if (isFirstSplit_) eventScheduler_ = parentScheduler ;
+        isFirstSplit_=false ;
+
+        services_[std::make_tuple(serviceId,partitionId)] = new CService(newServiceComm, childScheduler, Id_, serviceId, partitionId, type, nbPartitions) ;
        
-       MPI_Comm_size(newServiceComm,&serviceCommSize) ;
-       MPI_Comm_rank(newServiceComm,&serviceCommRank) ;
-       info(10)<<"Service  "<<serviceId<<" created "<<"  partition : " <<partitionId<<" service size : "<<serviceCommSize
-               << " service rank : "<<serviceCommRank <<" on rank pool "<<commRank<<endl ;
-      
-       services_[std::make_tuple(serviceId,partitionId)] = new CService(newServiceComm, Id_, serviceId, partitionId, type, nbPartitions) ;
-       
-       MPI_Comm_free(&newServiceComm) ;
-     }
-     MPI_Comm_free(&serviceComm) ;
+        MPI_Comm_free(&newServiceComm) ;
+      }
+      else
+      {
+        shared_ptr<CEventScheduler> parentScheduler, childScheduler ;
+        freeRessourceEventScheduler_->splitScheduler(serviceComm, parentScheduler, childScheduler) ;
+        if (isFirstSplit_) eventScheduler_ = parentScheduler ;
+        freeRessourceEventScheduler_ = childScheduler ;
+        isFirstSplit_=false ;
+      }
+      MPI_Comm_free(&serviceComm) ;
+    }
+    MPI_Comm_free(&freeComm) ;
   }
   
@@ -300,14 +340,14 @@
         shared_ptr<CEventScheduler>  eventScheduler = service.second->getEventScheduler() ;
         info(40)<<"CPoolRessource::createNewServiceOnto ; found onServiceId : "<<onServiceId<<endl  ;
-        services_[std::make_tuple(serviceId,partitionId)] = new CService(newServiceComm, Id_, serviceId, partitionId, type,
-                                                                         nbPartitions, eventScheduler) ;       
-      }
-    }
-    
-  }
-
-  void CPoolRessource::createService(MPI_Comm serviceComm, const std::string& serviceId, int partitionId, int type, int nbPartitions) // for clients & attached
-  {
-    services_[std::make_tuple(serviceId,partitionId)] = new CService(serviceComm, Id_, serviceId, partitionId, type, nbPartitions) ;
+        services_[std::make_tuple(serviceId,partitionId)] = new CService(newServiceComm, eventScheduler, Id_, serviceId, partitionId, type,
+                                                                         nbPartitions) ;       
+      }
+    }
+    
+  }
+
+  void CPoolRessource::createService(MPI_Comm serviceComm, shared_ptr<CEventScheduler> eventScheduler, const std::string& serviceId, int partitionId, int type, int nbPartitions) // for clients & attached
+  {
+    services_[std::make_tuple(serviceId,partitionId)] = new CService(serviceComm, eventScheduler, Id_, serviceId, partitionId, type, nbPartitions) ;
   }
 
Index: XIOS3/trunk/src/manager/pool_ressource.hpp
===================================================================
--- XIOS3/trunk/src/manager/pool_ressource.hpp	(revision 2522)
+++ XIOS3/trunk/src/manager/pool_ressource.hpp	(revision 2523)
@@ -5,4 +5,5 @@
 #include "window_manager.hpp"
 #include "services_manager.hpp"
+#include "event_scheduler.hpp"
 
 
@@ -27,14 +28,16 @@
 
     public:
-    CPoolRessource(MPI_Comm poolComm, const std::string& Id, bool isServer) ;
+    CPoolRessource(MPI_Comm poolComm, shared_ptr<CEventScheduler> eventScheduler, const std::string& Id, bool isServer) ;
     ~CPoolRessource() ;
     
     void createService(const std::string& serviceId, int type, int size, int nbPartition) ;
-    void createService(MPI_Comm serviceComm, const std::string& serviceId, int partitionId, int type, int nbPartitions) ; 
+    void createService(MPI_Comm serviceComm, shared_ptr<CEventScheduler> eventScheduler, const std::string& serviceId, int partitionId, int type, int nbPartitions) ; 
     void createServiceOnto(const std::string& serviceId, int type, const std::string& OnServiceId) ;
     bool eventLoop(bool serviceOnly=false) ;
+    bool hasService(const std::string serviceId, int partitionId) {return services_.count(make_tuple(serviceId,partitionId))>0 ;}
     CService* getService(const std::string serviceId, int partitionId) { return services_[make_tuple(serviceId,partitionId)]; }
     void finalizeSignal(void) ;
     string getId(void) { return Id_; }
+    const MPI_Comm& getCommunicator(void) { return poolComm_ ;}
 
   private:
@@ -53,4 +56,5 @@
 //    void checkCreateServiceNotification(void) ;
     void createNewService(const std::string& serviceId, int type, int size, int nbPartitions, bool in) ;
+  public:
     void createNewServiceOnto(const std::string& serviceId, int type, const string& onServiceId) ;
     
@@ -73,4 +77,12 @@
     const double eventLoopLatency_=0; 
     double lastEventLoop_=0. ;
+
+    private:
+      shared_ptr<CEventScheduler> eventScheduler_ ;
+      shared_ptr<CEventScheduler> freeRessourceEventScheduler_ ;
+      bool isFirstSplit_=true ;
+    public:
+      shared_ptr<CEventScheduler> getEventScheduler(void) { return eventScheduler_ ;}
+
   };
 
Index: XIOS3/trunk/src/manager/ressources_manager.hpp
===================================================================
--- XIOS3/trunk/src/manager/ressources_manager.hpp	(revision 2522)
+++ XIOS3/trunk/src/manager/ressources_manager.hpp	(revision 2523)
@@ -72,5 +72,5 @@
     MPI_Comm xiosComm_ ;
 
-    int notifyType_ ;
+    int notifyType_ = NOTIFY_NOTHING;
     tuple<std::string, int> notifyCreatePool_ ;
 
Index: XIOS3/trunk/src/manager/servers_ressource.cpp
===================================================================
--- XIOS3/trunk/src/manager/servers_ressource.cpp	(revision 2522)
+++ XIOS3/trunk/src/manager/servers_ressource.cpp	(revision 2523)
@@ -3,4 +3,5 @@
 #include "ressources_manager.hpp"
 #include "pool_ressource.hpp"
+#include "event_scheduler.hpp"
 #include "cxios.hpp"
 #include "mpi.hpp"
@@ -8,4 +9,5 @@
 #include <vector>
 #include <string>
+
 
 
@@ -39,5 +41,6 @@
 
     MPI_Comm_dup(serverComm_, &freeRessourcesComm_) ; 
-
+    eventScheduler_ = make_shared<CEventScheduler>(freeRessourcesComm_) ;
+    freeRessourceEventScheduler_ = eventScheduler_ ;
   }
 
@@ -160,11 +163,18 @@
     MPI_Comm_split(freeRessourcesComm_, isPartOf, commRank, &poolComm) ;
     
+    shared_ptr<CEventScheduler> parentScheduler, childScheduler ;
+    freeRessourceEventScheduler_->splitScheduler(poolComm, parentScheduler, childScheduler) ;
+    
+    if (isFirstSplit_) eventScheduler_ = parentScheduler ; 
+    isFirstSplit_ = false ;
+
     if (isPartOf)
     {  
-      poolRessource_ = new CPoolRessource(poolComm, poolId, true) ;
+      poolRessource_ = new CPoolRessource(poolComm, childScheduler, poolId, true) ;
       MPI_Comm_free(&poolComm) ;
     }
     else 
     {
+      freeRessourceEventScheduler_ = childScheduler ;
       MPI_Comm_free(&freeRessourcesComm_) ;
       freeRessourcesComm_=poolComm ;
Index: XIOS3/trunk/src/manager/servers_ressource.hpp
===================================================================
--- XIOS3/trunk/src/manager/servers_ressource.hpp	(revision 2522)
+++ XIOS3/trunk/src/manager/servers_ressource.hpp	(revision 2523)
@@ -3,4 +3,5 @@
 
 #include "window_manager.hpp"
+#include "event_scheduler.hpp"
 #include "mpi.hpp"
 #include <vector>
@@ -33,4 +34,5 @@
     void checkNotifications(void) ;
     CPoolRessource* getPoolRessource(void) { return poolRessource_; } 
+    const MPI_Comm& getCommunicator(void) { return serverComm_ ;}
     bool isServerLeader(void) ;
     void finalize(void) ;
@@ -54,4 +56,10 @@
     double lastEventLoop_=0. ;
 
+    private:
+      shared_ptr<CEventScheduler> eventScheduler_ ;
+      shared_ptr<CEventScheduler> freeRessourceEventScheduler_ ;
+      bool isFirstSplit_=true ;
+    public:
+      shared_ptr<CEventScheduler> getEventScheduler(void) { return eventScheduler_ ;}
     friend class CWindowManager ;
   } ;
Index: XIOS3/trunk/src/manager/services.cpp
===================================================================
--- XIOS3/trunk/src/manager/services.cpp	(revision 2522)
+++ XIOS3/trunk/src/manager/services.cpp	(revision 2523)
@@ -9,6 +9,6 @@
 namespace xios
 {
-  CService::CService(MPI_Comm serviceComm, const std::string& poolId, const std::string& serviceId, const int& partitionId, 
-                     int type, int nbPartitions, shared_ptr<CEventScheduler> eventScheduler) 
+  CService::CService(MPI_Comm serviceComm, shared_ptr<CEventScheduler> eventScheduler, const std::string& poolId, const std::string& serviceId, const int& partitionId, 
+                     int type, int nbPartitions) 
                          : finalizeSignal_(false), eventScheduler_(nullptr), poolId_(poolId), serviceId_(serviceId),
                            partitionId_(partitionId), type_(type), nbPartitions_(nbPartitions), hasNotification_(false)
@@ -191,5 +191,5 @@
           size_t hashId = hashString(name_) ;
           size_t currentTimeLine=0 ;
-          info(40)<<"CService::checkNotifications(void) : receive notification => event scheduler"<<endl ;
+          info(40)<<"CService::checkNotifications(void) : receive notification => event scheduler : timeLine : "<<currentTimeLine<<"  hashId : "<<hashId<<endl ;
           eventScheduler_->registerEvent(currentTimeLine,hashId); 
         }
@@ -203,5 +203,5 @@
       size_t hashId = hashString(name_) ;
       size_t currentTimeLine=0 ;
-      info(40)<<"CService::checkNotifications(void) : receive notification => event scheduler : eventIsReceived ?"<<endl ;
+//      info(40)<<"CService::checkNotifications(void) : receive notification => event scheduler : eventIsReceived ?"<<endl ;
       if (eventScheduler_->queryEvent(currentTimeLine,hashId))
       {
Index: XIOS3/trunk/src/manager/services.hpp
===================================================================
--- XIOS3/trunk/src/manager/services.hpp	(revision 2522)
+++ XIOS3/trunk/src/manager/services.hpp	(revision 2523)
@@ -19,6 +19,6 @@
     const int NOTIFY_CREATE_CONTEXT=1 ;
 
-    CService(MPI_Comm serviceComm, const std::string& poolId, const std::string& serviceId, const int& partitionId, 
-             int type, int nbPartitions, shared_ptr<CEventScheduler> = nullptr) ;
+    CService(MPI_Comm serviceComm, shared_ptr<CEventScheduler>, const std::string& poolId, const std::string& serviceId, const int& partitionId, 
+             int type, int nbPartitions) ;
     ~CService() ;
 
Index: XIOS3/trunk/src/manager/services_manager.cpp
===================================================================
--- XIOS3/trunk/src/manager/services_manager.cpp	(revision 2522)
+++ XIOS3/trunk/src/manager/services_manager.cpp	(revision 2523)
@@ -304,3 +304,10 @@
   }
 
+  void CServicesManager::waitServiceRegistration(const std::string& poolId, const std::string& serviceId)
+  {
+    int nbPartition ;
+    getServiceNbPartitions(poolId,serviceId,0,nbPartition, true) ;
+    for(int n=1;n<nbPartition;n++) waitServiceRegistration(poolId, serviceId, n) ;
+
+  }
 }
Index: XIOS3/trunk/src/manager/services_manager.hpp
===================================================================
--- XIOS3/trunk/src/manager/services_manager.hpp	(revision 2522)
+++ XIOS3/trunk/src/manager/services_manager.hpp	(revision 2523)
@@ -49,4 +49,5 @@
     bool hasService(const std::string& poolId, const std::string& serviceId, const int& partitionId) ;
     void waitServiceRegistration(const std::string& poolId, const std::string& serviceId, const int& partitionId);
+    void waitServiceRegistration(const std::string& poolId, const std::string& serviceId);
     void servicesDumpOut(CBufferOut& buffer) ;
     void servicesDumpIn(CBufferIn& buffer) ;
@@ -74,5 +75,5 @@
     MPI_Comm xiosComm_ ;
 
-    int notifyType_ ;
+    int notifyType_ = NOTIFY_NOTHING ;
     tuple<std::string, int, int, int> notifyCreateService_ ;
     tuple<std::string, int, std::string> notifyCreateServiceOnto_ ;
Index: XIOS3/trunk/src/server.cpp
===================================================================
--- XIOS3/trunk/src/server.cpp	(revision 2522)
+++ XIOS3/trunk/src/server.cpp	(revision 2523)
@@ -202,5 +202,7 @@
             ressourcesManager->waitPoolRegistration(CXios::defaultPoolId) ;
             servicesManager->createServices(CXios::defaultPoolId, CXios::defaultWriterId, CServicesManager::WRITER,nbRessources,1) ;
+            servicesManager->waitServiceRegistration(CXios::defaultPoolId, CXios::defaultWriterId) ;
             servicesManager->createServicesOnto(CXios::defaultPoolId, CXios::defaultReaderId, CServicesManager::READER, CXios::defaultWriterId) ;
+            servicesManager->waitServiceRegistration(CXios::defaultPoolId, CXios::defaultReaderId) ;
           }
           else
@@ -214,14 +216,30 @@
             ressourcesManager->waitPoolRegistration(CXios::defaultPoolId) ;
             servicesManager->createServices(CXios::defaultPoolId,  CXios::defaultGathererId, CServicesManager::GATHERER, nprocsGatherer, 1) ;
+            servicesManager->waitServiceRegistration(CXios::defaultPoolId, CXios::defaultGathererId) ;
             servicesManager->createServicesOnto(CXios::defaultPoolId, CXios::defaultReaderId, CServicesManager::READER, CXios::defaultGathererId) ;
+            servicesManager->waitServiceRegistration(CXios::defaultPoolId, CXios::defaultReaderId) ;
             servicesManager->createServices(CXios::defaultPoolId,  CXios::defaultWriterId, CServicesManager::WRITER, nprocsServer, nbPoolsServer2) ;
+            servicesManager->waitServiceRegistration(CXios::defaultPoolId, CXios::defaultWriterId) ;
           }
         }
 //        servicesManager->createServices(CXios::defaultPoolId,  CXios::defaultServicesId, CServicesManager::ALL_SERVICES, nbRessources, 1) ;
       }
+
+      MPI_Request req ;
+      MPI_Status status ;
+      MPI_Ibarrier(getServersRessource()->getCommunicator(),&req) ; // be sure that all services are created now, could be remove later if more asynchronisity
+      int ok=false ;
+      while (!ok)
+      {
+        daemonsManager->eventLoop() ;
+        MPI_Test(&req,&ok,&status) ;
+      }
+
+
+      testingEventScheduler() ;
 /*
       MPI_Request req ;
       MPI_Status status ;
-      MPI_Ibarrier(xiosGlobalComm,&req) ; // be sure that all services are created now, could be remove later if more asynchronisity
+      MPI_Ibarrier(CXios::getXiosComm(),&req) ; // be sure that all services are created now, could be remove later if more asynchronisity
       int ok=false ;
       while (!ok)
@@ -252,5 +270,70 @@
 
 
-
+    void CServer::testingEventScheduler(void)
+    {
+      CXios::getPoolRessource()->getEventScheduler()->registerEvent(1,10) ;
+      CXios::getPoolRessource()->getEventScheduler()->registerEvent(2,10) ;
+      if (CXios::getPoolRessource()->hasService(CXios::defaultGathererId,0))
+      {
+        CXios::getPoolRessource()->getService(CXios::defaultGathererId,0)-> getEventScheduler()->registerEvent(1,100) ;
+        CXios::getPoolRessource()->getService(CXios::defaultGathererId,0)-> getEventScheduler()->registerEvent(2,100) ;
+        CXios::getPoolRessource()->getService(CXios::defaultGathererId,0)-> getEventScheduler()->registerEvent(3,100) ;
+      }
+      if (CXios::getPoolRessource()->hasService(CXios::defaultWriterId,0))
+      {
+        CXios::getPoolRessource()->getService(CXios::defaultWriterId,0)-> getEventScheduler()->registerEvent(1,1000) ;
+        CXios::getPoolRessource()->getService(CXios::defaultWriterId,0)-> getEventScheduler()->registerEvent(2,1000) ;
+      }
+      CXios::getPoolRessource()->getEventScheduler()->registerEvent(3,10) ;
+      CXios::getPoolRessource()->getEventScheduler()->registerEvent(4,10) ;
+      
+      if (CXios::getPoolRessource()->hasService(CXios::defaultGathererId,0))
+      {
+        CXios::getPoolRessource()->getService(CXios::defaultGathererId,0)-> getEventScheduler()->registerEvent(4,100) ;
+        CXios::getPoolRessource()->getService(CXios::defaultGathererId,0)-> getEventScheduler()->registerEvent(5,100) ;
+      }
+      if (CXios::getPoolRessource()->hasService(CXios::defaultWriterId,0))
+      {
+        CXios::getPoolRessource()->getService(CXios::defaultWriterId,0)-> getEventScheduler()->registerEvent(3,1000) ;
+        CXios::getPoolRessource()->getService(CXios::defaultWriterId,0)-> getEventScheduler()->registerEvent(4,1000) ;
+        CXios::getPoolRessource()->getService(CXios::defaultWriterId,0)-> getEventScheduler()->registerEvent(5,1000) ;
+      }
+      CXios::getPoolRessource()->getEventScheduler()->registerEvent(5,10) ;
+      CXios::getPoolRessource()->getEventScheduler()->registerEvent(6,10) ;
+      
+      int numEvents=0 ;
+      int poolEvent=1 ;
+      int gatherEvent=1 ;
+      int writerEvent=1 ;
+      do
+      {
+        if (CXios::getPoolRessource()->getEventScheduler()->queryEvent(poolEvent,10))
+        {
+          CXios::getPoolRessource()->getEventScheduler()->popEvent() ;
+          MPI_Barrier(CXios::getPoolRessource()->getCommunicator());
+          poolEvent++ ;
+          numEvents++;
+        }
+        
+        if (CXios::getPoolRessource()->getEventScheduler()->queryEvent(gatherEvent,100))
+        {
+          CXios::getPoolRessource()->getEventScheduler()->popEvent() ;
+          MPI_Barrier(CXios::getPoolRessource()->getService(CXios::defaultGathererId,0)->getCommunicator());
+          gatherEvent++ ;
+          numEvents++;
+        }
+
+        if (CXios::getPoolRessource()->getEventScheduler()->queryEvent(writerEvent,1000))
+        {
+          CXios::getPoolRessource()->getEventScheduler()->popEvent() ;
+          MPI_Barrier(CXios::getPoolRessource()->getService(CXios::defaultWriterId,0)->getCommunicator());
+          writerEvent++ ;
+          numEvents++;
+        }
+
+        
+      } while (numEvents!=11) ;
+
+    }
 
 
@@ -410,7 +493,8 @@
          boost::hash<string> hashString;
          size_t hashId = hashString("oasis_enddef");
-         if (CXios::getPoolRessource()->getService(CXios::defaultServicesId,0)->getEventScheduler()->queryEvent(0,hashId))
+
+         if (CXios::getPoolRessource()->getEventScheduler()->queryEvent(0,hashId))
          {
-           CXios::getPoolRessource()->getService(CXios::defaultServicesId,0)->getEventScheduler()->popEvent() ;
+           CXios::getPoolRessource()->getEventScheduler()->popEvent() ;
            driver_->endSynchronizedDefinition() ;
            eventSent=false ;
@@ -426,5 +510,5 @@
            boost::hash<string> hashString;
            size_t hashId = hashString("oasis_enddef");
-           CXios::getPoolRessource()->getService(CXios::defaultServicesId,0)->getEventScheduler()->registerEvent(0,hashId);
+           CXios::getPoolRessource()->getEventScheduler()->registerEvent(0,hashId);
            eventSent=true ;
        }
Index: XIOS3/trunk/src/server.hpp
===================================================================
--- XIOS3/trunk/src/server.hpp	(revision 2522)
+++ XIOS3/trunk/src/server.hpp	(revision 2523)
@@ -43,5 +43,6 @@
         static void listenRootOasisEnddef(void);
         static void listenOasisEnddef(void);
-
+        static void testingEventScheduler(void);
+        
         static void finalize(void);
         static void eventLoop(void);
