Changeset 1486:da919ff0985c


Ignore:
Timestamp:
08/30/10 15:50:08 (18 months ago)
Author:
niam
Branch:
default
Message:

[pc::execution::workqueue] gently check the closing flag

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sources/src/pcExecutionWorkqueue.cc

    r1484 r1486  
    113113    dodoList<__work__ *>::iterator o, p; 
    114114 
    115     threadsProtector->acquire(); 
     115    tasksProtector->acquire(); 
    116116    closing = true; 
    117     threadsProtector->release(); 
    118  
    119     tasksProtector->acquire(); 
     117 
    120118    o = tasks.begin(); 
    121119    p = tasks.end(); 
     
    130128    j = inactive.end(); 
    131129    for (; i != j; ++i) { 
    132         /* (*i)->stop(); */ 
     130        /* (*i)->wait(); */ 
    133131        delete *i; 
    134132    } 
     
    204202            } 
    205203 
    206             if (queue->closing) 
     204            tasksProtector->acquire(); 
     205            if (queue->closing) { 
     206                tasksProtector->release(); 
     207 
    207208                return 0; 
     209            } 
     210            tasksProtector->release(); 
    208211 
    209212            unsigned long delta = queue->maxThreads - queue->minThreads; 
     
    223226            if (!queue->notification->wait(timeout)) { 
    224227                unsigned long queueSize = tasks.size(); 
     228 
     229                if (queue->closing) { 
     230                    tasksProtector->release(); 
     231 
     232                    return 0; 
     233                } 
    225234                tasksProtector->release(); 
    226  
    227                 if (queue->closing) 
    228                     return 0; 
    229235 
    230236                if (queueSize == 0) { 
Note: See TracChangeset for help on using the changeset viewer.