beagle r4887 - trunk/beagle/Util



Author: dbera
Date: Thu Nov 27 04:13:41 2008
New Revision: 4887
URL: http://svn.gnome.org/viewvc/beagle?rev=4887&view=rev

Log:
Do not add duplicate tasks to the list of cancelled tasks.


Modified:
   trunk/beagle/Util/Scheduler.cs

Modified: trunk/beagle/Util/Scheduler.cs
==============================================================================
--- trunk/beagle/Util/Scheduler.cs	(original)
+++ trunk/beagle/Util/Scheduler.cs	Thu Nov 27 04:13:41 2008
@@ -1097,6 +1097,12 @@
 
 		internal void ReportCancelledTask (string description)
 		{
+			// The number of cancelled tasks will be low,
+			// so there is no harm in checking for duplicates
+			// by doing a linear search.
+			if (cancelled_tasks.Contains (description))
+				return;
+
 			cancelled_tasks.Add (description);
 		}
 
@@ -1107,9 +1113,9 @@
 		public SchedulerInformation GetCurrentStatus ()
 		{
 		    SchedulerInformation current_status = new SchedulerInformation ();
-			
+
 			lock (big_lock) {
-				
+
 				ArrayList blocked_tasks = new ArrayList ();
 				ArrayList future_tasks = new ArrayList ();
 				ArrayList pending_tasks = new ArrayList ();



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]