Changeset 884


Ignore:
Timestamp:
07/05/16 15:00:57 (5 years ago)
Author:
rlacroix
Message:

Fix a possible deadlock for clients communicating with at least two servers.

The event scheduler introduces a dependency between servers so clients must check all their buffers when waiting for a specific buffer to be free again.

This commit partially fixes the issue described in ticket #91.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • XIOS/trunk/src/context_client.cpp

    r731 r884  
    133133      list<CClientBuffer*>::iterator itBuffer; 
    134134      list<CBufferOut*>  retBuffer; 
    135       bool free; 
     135      bool areBuffersFree; 
    136136 
    137137      for (itServer = serverList.begin(); itServer != serverList.end(); itServer++) 
     
    145145        bufferList.push_back(it->second); 
    146146      } 
    147       free = false; 
    148147 
    149148      CTimer::get("Blocking time").resume(); 
    150       while (!free) 
    151       { 
    152         free = true; 
     149      do 
     150      { 
     151        areBuffersFree = true; 
    153152        for (itBuffer = bufferList.begin(), itSize = sizeList.begin(); itBuffer != bufferList.end(); itBuffer++, itSize++) 
    154         { 
    155           (*itBuffer)->checkBuffer(); 
    156          free &= (*itBuffer)->isBufferFree(*itSize); 
    157         } 
    158         if (!free) 
     153          areBuffersFree &= (*itBuffer)->isBufferFree(*itSize); 
     154 
     155        if (!areBuffersFree) 
     156        { 
     157          checkBuffers(); 
    159158          context->server->listen(); 
    160       } 
     159        } 
     160      } while (!areBuffersFree); 
    161161      CTimer::get("Blocking time").suspend(); 
    162162 
Note: See TracChangeset for help on using the changeset viewer.