Free cookie consent management tool by TermsFeed Policy Generator

Changeset 8807


Ignore:
Timestamp:
10/15/12 13:35:33 (12 years ago)
Author:
svonolfe
Message:

Fixed threading issues (#1955)

Location:
branches/DynamicVehicleRouting/HeuristicLab.PDPSimulation/3.3
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/DynamicVehicleRouting/HeuristicLab.PDPSimulation/3.3/Optimizers/DynamicPDPOptimization.cs

    r8670 r8807  
    229229    protected virtual void EndOptimization() {
    230230      SignalWaitHandle();
     231      running = false;
    231232    }
    232233
     
    340341          RelocateVehicles(simulationTime + GetTimeStep(), finish);
    341342
    342         if (finish)
    343           running = false;
    344         else
     343        if (!finish)
    345344          SignalWaitHandle();
    346345      }
  • branches/DynamicVehicleRouting/HeuristicLab.PDPSimulation/3.3/PickupDeliveryOptimization.cs

    r8779 r8807  
    337337      InitWaitHandle(synchronized);
    338338
    339       EventWaitHandle wh = new EventWaitHandle(false, EventResetMode.ManualReset);
    340 
    341       cts = new CancellationTokenSource();
    342       optThread = new Thread(delegate() {
    343         wh.Set();
    344         Optimize(cts.Token);
    345       });
    346       optThread.IsBackground = true;
    347       optThread.Start();
    348 
    349       wh.WaitOne();
     339      using (EventWaitHandle wh = new EventWaitHandle(false, EventResetMode.ManualReset)) {
     340        cts = new CancellationTokenSource();
     341        optThread = new Thread(delegate() {
     342          wh.Set();
     343          Optimize(cts.Token);
     344        });
     345        optThread.IsBackground = true;
     346        optThread.Start();
     347
     348        wh.WaitOne();
     349      }
    350350    }
    351351
Note: See TracChangeset for help on using the changeset viewer.