Changeset 349

Show
Ignore:
Timestamp:
06/01/07 17:14:15 (2 years ago)
Author:
blackhedd
Message:

Changed the location of the loop-break handler from before normal descriptors to after.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • version_0/ext/em.cpp

    r336 r349  
    331331                int s = EmSelect (maxsocket+1, &fdreads, &fdwrites, NULL, &tv); 
    332332                if (s > 0) { 
    333                         if (FD_ISSET (LoopBreakerReader, &fdreads)) 
    334                                 _ReadLoopBreaker(); 
    335  
     333                        /* Changed 01Jun07. We used to handle the Loop-breaker right here. 
     334                         * Now we do it AFTER all the regular descriptors. There's an 
     335                         * incredibly important and subtle reason for this. Code on 
     336                         * loop breakers is sometimes used to cause the reactor core to 
     337                         * cycle (for example, to allow outbound network buffers to drain). 
     338                         * If a loop-breaker handler reschedules itself (say, after determining 
     339                         * that the write buffers are still too full), then it will execute 
     340                         * IMMEDIATELY if _ReadLoopBreaker is done here instead of after 
     341                         * the other descriptors are processed. That defeats the whole purpose. 
     342                         */ 
    336343                        for (i=0; i < Descriptors.size(); i++) { 
    337344                                EventableDescriptor *ed = Descriptors[i]; 
     
    345352                                        ed->Read(); 
    346353                        } 
     354 
     355                        if (FD_ISSET (LoopBreakerReader, &fdreads)) 
     356                                _ReadLoopBreaker(); 
    347357                } 
    348358                else if (s < 0) {