Ignore:
Timestamp:
05/18/17 19:27:26 (4 years ago)
Author:
oabramkina
Message:

Fixing a bug in context finalization. Now context finalization is done in two stages.
Tested on Cure with test_regular and test_xios2_cmip6.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • XIOS/dev/dev_olga/src/context_client.cpp

    r1130 r1139  
    276276      map<int,CClientBuffer*>::iterator itBuff; 
    277277      for (itBuff = buffers.begin(); itBuff != buffers.end(); itBuff++) 
     278      { 
    278279          delete itBuff->second; 
     280      } 
    279281      buffers.clear(); 
    280282   } 
     
    420422    //releaseBuffers(); // moved to CContext::finalize() 
    421423  } 
     424 
     425  /*! 
     426  * Finalize context client and do some reports. Function is non-blocking. 
     427  */ 
     428 void CContextClient::postFinalize(void) 
     429 { 
     430   map<int,CClientBuffer*>::iterator itBuff; 
     431   bool stop = false; 
     432 
     433   CTimer::get("Blocking time").resume(); 
     434   while (hasTemporarilyBufferedEvent()) 
     435   { 
     436     checkBuffers(); 
     437     sendTemporarilyBufferedEvent(); 
     438   } 
     439   CTimer::get("Blocking time").suspend(); 
     440 
     441   CEventClient event(CContext::GetType(), CContext::EVENT_ID_CONTEXT_POST_FINALIZE); 
     442   if (isServerLeader()) 
     443   { 
     444     CMessage msg; 
     445     const std::list<int>& ranks = getRanksServerLeader(); 
     446     for (std::list<int>::const_iterator itRank = ranks.begin(), itRankEnd = ranks.end(); itRank != itRankEnd; ++itRank) 
     447       event.push(*itRank, 1, msg); 
     448     sendEvent(event); 
     449   } 
     450   else sendEvent(event); 
     451 
     452   CTimer::get("Blocking time").resume(); 
     453//    while (!stop) 
     454   { 
     455     checkBuffers(); 
     456     if (hasTemporarilyBufferedEvent()) 
     457       sendTemporarilyBufferedEvent(); 
     458 
     459     stop = true; 
     460   } 
     461   CTimer::get("Blocking time").suspend(); 
     462 
     463 } 
    422464 
    423465  /*! 
Note: See TracChangeset for help on using the changeset viewer.