Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
01/04/11 06:17:50 (13 years ago)
Author:
swagner
Message:

Adapted EAs to enable parallel solution evaluation (#1333)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Operators/3.3/IntCounter.cs

    r4722 r5208  
    3333  [StorableClass]
    3434  public sealed class IntCounter : SingleSuccessorOperator {
     35    private object locker = new object();
     36
    3537    public LookupParameter<IntValue> ValueParameter {
    3638      get { return (LookupParameter<IntValue>)Parameters["Value"]; }
     
    6062
    6163    public override IOperation Apply() {
    62       if (ValueParameter.ActualValue == null) ValueParameter.ActualValue = new IntValue();
    63       ValueParameter.ActualValue.Value += IncrementParameter.ActualValue.Value;
     64      lock (locker) {
     65        if (ValueParameter.ActualValue == null) ValueParameter.ActualValue = new IntValue();
     66        ValueParameter.ActualValue.Value += IncrementParameter.ActualValue.Value;
     67      }
    6468      return base.Apply();
    6569    }
Note: See TracChangeset for help on using the changeset viewer.