- Timestamp:
- 12/03/11 01:01:47 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Clients.Hive/3.3/TaskDownloader.cs
r7020 r7115 25 25 using HeuristicLab.Clients.Hive.Jobs; 26 26 using HeuristicLab.Common; 27 using System.Threading; 27 28 28 29 namespace HeuristicLab.Clients.Hive { … … 33 34 private bool exceptionOccured = false; 34 35 private Exception currentException; 36 private ReaderWriterLockSlim resultsLock = new ReaderWriterLockSlim(); 35 37 36 38 public bool IsFinished { 37 39 get { 38 return results.Count == taskIds.Count(); 40 try { 41 resultsLock.EnterReadLock(); 42 return results.Count == taskIds.Count(); 43 } finally { resultsLock.ExitReadLock(); } 39 44 } 40 45 } … … 54 59 public int FinishedCount { 55 60 get { 56 return results.Count; 61 try { 62 resultsLock.EnterReadLock(); 63 return results.Count; 64 } finally { resultsLock.ExitReadLock(); } 57 65 } 58 66 } … … 60 68 public IDictionary<Guid, HiveTask> Results { 61 69 get { 62 return results; 70 try { 71 resultsLock.EnterReadLock(); 72 return results; 73 } finally { resultsLock.ExitReadLock(); } 63 74 } 64 75 } … … 73 84 public void StartAsync() { 74 85 foreach (Guid taskId in taskIds) { 75 Task task = ServiceLocator.Instance.CallHiveService(s => s.GetTask(taskId)); 76 77 taskDownloader.DownloadTask(task, 86 taskDownloader.DownloadTaskDataAndTask(taskId, 78 87 (localJob, itemJob) => { 79 88 if (localJob != null && itemJob != null) { … … 85 94 } 86 95 hiveTask.Task = localJob; 87 this.results.Add(localJob.Id, hiveTask); 96 try { 97 resultsLock.EnterWriteLock(); 98 this.results.Add(localJob.Id, hiveTask); 99 } finally { resultsLock.ExitWriteLock(); } 88 100 } 89 101 });
Note: See TracChangeset
for help on using the changeset viewer.