Example #1
0
        public static ThreadStarter StartImmediate(Action action, string threadName)
        {
            var thread = new ThreadStarter(action, threadName);

            thread.Start();
            return(thread);
        }
Example #2
0
 /// <summary>
 ///     Add's a <c>ThreadStarter</c> element to the internal thread list
 /// </summary>
 /// <remarks>
 ///     Raises the <see cref="ThreadAdded" /> event.
 /// </remarks>
 /// <param name="thread">The ThreadStarter element to add</param>
 private static void RegisterThread(ThreadStarter thread)
 {
     Threads.Add(thread);
     if (ThreadAdded != null)
     {
         ThreadAdded(null, thread);
     }
 }
Example #3
0
 /// <summary>
 ///     Remove a ThreadStarter element from the internal thread list
 /// </summary>
 /// <remarks>
 ///     Raises the <see cref="ThreadRemoved" /> event.
 /// </remarks>
 /// <param name="thread">The ThreadStarter element to remove</param>
 private static void UnregisterThread(ThreadStarter thread)
 {
     try
     {
         Threads.Remove(thread);
     }
     catch (ArgumentOutOfRangeException e)
     {
         TraceHelper.TraceError(string.Format("ThreadStarter.UnregisterThread encountered an exception: {0}", e.Message));
     }
     finally
     {
         if (ThreadRemoved != null)
         {
             ThreadRemoved(null, thread);
         }
     }
 }