1) Latest version

rg2023 [2002-12-09 20:32:36]
1) Latest version
Filename
csharpsrc/AsyncCore/AsyncCore.suo
csharpsrc/AsyncCore/TaskPool.cs
csharpsrc/AsyncCore/TaskProxy.cs
csharpsrc/AsyncCore/TaskRequest.cs
diff --git a/csharpsrc/AsyncCore/AsyncCore.suo b/csharpsrc/AsyncCore/AsyncCore.suo
index 8fa5fde..3a39f4c 100644
Binary files a/csharpsrc/AsyncCore/AsyncCore.suo and b/csharpsrc/AsyncCore/AsyncCore.suo differ
diff --git a/csharpsrc/AsyncCore/TaskPool.cs b/csharpsrc/AsyncCore/TaskPool.cs
index b405657..d091f6b 100644
--- a/csharpsrc/AsyncCore/TaskPool.cs
+++ b/csharpsrc/AsyncCore/TaskPool.cs
@@ -110,17 +110,25 @@ namespace PSL.AsyncCore
 		/// <param name="tceArg">TPTask completion event arguement</param>
 		private static void OnTPTaskComplete( TPTaskCompleteEventArgs tceArg )
 		{
-			lock( ClientNotification.SyncRoot )
+			try
 			{
-				if( ClientNotification.ContainsKey( tceArg.TaskID ) )
+				lock( ClientNotification.SyncRoot )
 				{
-					TaskRequest.NotificationCallback objNotify = (TaskRequest.NotificationCallback) ClientNotification[tceArg.TaskID];
-					// Notifiy specific client
-					objNotify( tceArg );
-					// Remove subscription
-					ClientNotification.Remove( tceArg.TaskID );
+					if( ClientNotification.ContainsKey( tceArg.TaskID ) )
+					{
+						TaskRequest.NotificationCallback objNotify = (TaskRequest.NotificationCallback) ClientNotification[tceArg.TaskID];
+						if( objNotify != null )
+						{
+							// Notifiy specific client
+							objNotify( tceArg );
+							// Remove subscription
+							ClientNotification.Remove( tceArg.TaskID );
+						}
+					}
 				}
 			}
+			catch( Exception /*e*/ )
+			{}
 		}

 		/// <summary>
@@ -145,24 +153,29 @@ namespace PSL.AsyncCore

 			Guid taskID = Guid.Empty;

-			lock( TPTask.requestQ.SyncRoot )
+			try
 			{
-				// Generate Guid - task id if none exists
-				if( req.TaskID == Guid.Empty )
-					req.TaskID = Guid.NewGuid();
-
-				taskID = req.TaskID;
+				lock( TPTask.requestQ.SyncRoot )
+				{
+					// Generate Guid - task id if none exists
+					if( req.TaskID == Guid.Empty )
+						req.TaskID = Guid.NewGuid();
+
+					taskID = req.TaskID;

-				// Add request item to TPTask requestQ
-				TPTask.requestQ.Enqueue( req );
-			}// End-lock on TPTask.requestQ
+					// Add request item to TPTask requestQ
+					TPTask.requestQ.Enqueue( req );
+				}// End-lock on TPTask.requestQ

-			// Tag taskID to notification callback
-			lock( ClientNotification.SyncRoot )
-			{
-				if( taskID != Guid.Empty )
-					ClientNotification.Add( taskID, req.NotifyCb );
-			}// End-lock on ClientNotification
+				// Tag taskID to notification callback
+				lock( ClientNotification.SyncRoot )
+				{
+					if( taskID != Guid.Empty && req.NotifyCb != null )
+						ClientNotification.Add( taskID, req.NotifyCb );
+				}// End-lock on ClientNotification
+			}
+			catch( Exception /*e*/ )
+			{}

 			// Return taskID to client
 			return taskID;
@@ -178,38 +191,43 @@ namespace PSL.AsyncCore
 			if( TPTask.Tasks != 0 )
 				return;

-			lock( lstTasks.SyncRoot )
+			try
 			{
-				// If shutting down then exit
-				if( bShuttingDown )
-					return;
-
-				// If already initialized then exit
-				if( bInitialized )
-					return;
-
-				// Hook up event handlers and flag initialized
-				if( !bInitialized )
+				lock( lstTasks.SyncRoot )
 				{
-					TPTask.TPTaskComplete += new TPTask.TPTaskCompleteHandler( OnTPTaskComplete );
-					bInitialized = true;
-				}
+					// If shutting down then exit
+					if( bShuttingDown )
+						return;
+
+					// If already initialized then exit
+					if( bInitialized )
+						return;
+
+					// Hook up event handlers and flag initialized
+					if( !bInitialized )
+					{
+						TPTask.TPTaskComplete += new TPTask.TPTaskCompleteHandler( OnTPTaskComplete );
+						bInitialized = true;
+					}

-				for( int i = 0; i < MIN_ACTIVE_TASKS; i++ )
-				{
-					TPTaskInit init = new TPTaskInit();
-					// Create new TPTask
-					init.Task = new TPTask( ref condition );
-					// Keep thread in ThreadPool
-					init.Task.RecycleTask = true;
-					// Create worker thread
-					init.Worker = new Thread( new ThreadStart( init.Task.Service ) );
-					// Start worker
-					init.Worker.Start();
-					// Add this task to our list of tasks
-					lstTasks.Add( init );
-				}
-			}//End-Lock on lstTasks
+					for( int i = 0; i < MIN_ACTIVE_TASKS; i++ )
+					{
+						TPTaskInit init = new TPTaskInit();
+						// Create new TPTask
+						init.Task = new TPTask( ref condition );
+						// Keep thread in ThreadPool
+						init.Task.RecycleTask = true;
+						// Create worker thread
+						init.Worker = new Thread( new ThreadStart( init.Task.Service ) );
+						// Start worker
+						init.Worker.Start();
+						// Add this task to our list of tasks
+						lstTasks.Add( init );
+					}
+				}//End-Lock on lstTasks
+			}//End-try
+			catch( Exception /*e*/ )
+			{}
 		}

 		/// <summary>
diff --git a/csharpsrc/AsyncCore/TaskProxy.cs b/csharpsrc/AsyncCore/TaskProxy.cs
index 95b0661..058e0a6 100644
--- a/csharpsrc/AsyncCore/TaskProxy.cs
+++ b/csharpsrc/AsyncCore/TaskProxy.cs
@@ -31,7 +31,7 @@ namespace PSL.AsyncCore
 		/// Condition variable used to reference client provided
 		/// conditon variable
 		/// </summary>
-		private AutoResetEvent m_condition = null;
+		private AutoResetEvent m_condition = new AutoResetEvent( false );

 		/// <summary>
 		/// Queue of TaskReqests
@@ -59,11 +59,8 @@ namespace PSL.AsyncCore
 		/// <param name="condition">Reference to a conditon variable
 		/// the TaskProxy will signal on when all TaskRequests queued
 		/// are ready.</param>
-		public TaskProxy( ref AutoResetEvent condition )
+		public TaskProxy()
 		{
-			// Set condition to non-signaled
-			condition.Reset();
-			m_condition = condition;
 		}

 		/// <summary>
@@ -75,18 +72,13 @@ namespace PSL.AsyncCore
 			get
 			{ return m_nTasksPending; }
 		}
-
-		// Do we really want to do this? - Support multiple callers on a
-		// single proxy - if so we may want to add an event to notify clients
-		// when a proxy is being reset so that it passes what data it has
-		// in the reset event
-		//public AutoResetEvent Condition
-		//{
-		//	get
-		//	{ return m_condition; }
-		//}
-

+		public enuTaskProxyStatus Status
+		{
+			get
+			{ return m_status; }
+		}
+
 		public void WaitOnProxySignal()
 		{
 			if( m_nTasksPending == 0 )
diff --git a/csharpsrc/AsyncCore/TaskRequest.cs b/csharpsrc/AsyncCore/TaskRequest.cs
index 483b463..1f24cd5 100644
--- a/csharpsrc/AsyncCore/TaskRequest.cs
+++ b/csharpsrc/AsyncCore/TaskRequest.cs
@@ -101,7 +101,7 @@ namespace PSL.AsyncCore
 		public bool IsValid
 		{
 			get
-			{ return m_objTaskCb != null && m_objNotifyCb != null; }
+			{ return m_objTaskCb != null; }
 		}

 		/// <summary>