Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
03/20/09 13:56:55 (16 years ago)
Author:
kgrading
Message:

splitted the sendfinishedjob / snapshot method in two seperate methods, fixed the locking, added real memory management (#529)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Hive.Client.Core/ConfigurationManager/ConfigManager.cs

    r1132 r1379  
    100100    /// <returns></returns>
    101101    public StatusCommons GetStatusForClientConsole() {
     102      //Todo: Locking
    102103      StatusCommons st = new StatusCommons();
    103104      st.ClientGuid = hardwareInfo.ClientId;
     
    113114      st.Jobs = new List<JobStatus>();
    114115
    115       foreach (KeyValuePair<long, Executor> kvp in engines) {
    116         Executor e = kvp.Value;
    117         st.Jobs.Add(new JobStatus { JobId = e.JobId, Progress = e.Progress, Since = e.CreationTime });
     116      lock (engines) {
     117        foreach (KeyValuePair<long, Executor> kvp in engines) {
     118          Executor e = kvp.Value;
     119          st.Jobs.Add(new JobStatus { JobId = e.JobId, Progress = e.Progress, Since = e.CreationTime });
     120        }
    118121      }
    119122      return st;     
     
    123126      Dictionary<long,double> prog = new Dictionary<long,double>();
    124127      Dictionary<long, Executor> engines = Core.GetExecutionEngines();
    125       foreach (KeyValuePair<long, Executor> kvp in engines) {
    126         Executor e = kvp.Value;
    127         prog[e.JobId] = e.Progress;
     128      lock (engines) {
     129        foreach (KeyValuePair<long, Executor> kvp in engines) {
     130          Executor e = kvp.Value;
     131          prog[e.JobId] = e.Progress;
     132        }
    128133      }
    129134      return prog;
Note: See TracChangeset for help on using the changeset viewer.