Nexus.Client.Util.Threading.TrackedThread.Start C# (CSharp) Method

Start() public method

Starts the thread.
public Start ( ) : void
return void
		public void Start()
		{
			m_thdThread.Start();
		}

Same methods

TrackedThread::Start ( object p_objParam ) : void

Usage Example

		/// <summary>
		/// Starts the task, optionally in a background thread.
		/// </summary>
		/// <remarks>
		/// If the task is started in a background thread, the task will be terminated in the
		/// calling thread terminates. Otherwise, the calling thread will not terminate until
		/// the task completes.
		/// </remarks>
		/// <param name="p_booRunInBackground">Whether the task should be run in a background thread.</param>
		/// <param name="p_objArgs">Arguments to pass to the task execution method.</param>
		/// <seealso cref="Start(object[])"/>
		/// <seealso cref="StartWait(object[])"/>
		/// <seealso cref="StartWait(bool, object[])"/>
		protected void Start(bool p_booRunInBackground, params object[] p_objArgs)
		{
			//Not sure if BeginInvoke/EndInvoke or Thread is better for exception handling
			// it seem BeginInvoke/EndInvoke is not ideal. exceptions are trapped and rethrown
			// in EndThreadInvokeHandler when EnInvoke is called, so the debugger
			// breaks in EndThreadInvokeHandler, and not where the exception is actually thrown
			//however, I was using threads here, and I changed. according the the SVN log, I made
			// the switch to improve exception handling. not sure what issue I was encountering.
			// maybe the issue was actually related to the fact that some operations at the time
			// were wrapped in unneccessary threads - that issue has since been resolved
			//
			//I would like to find, and then document, a specific case where the thread
			// provides an advantage over BeginInvoke/EndInvoke. in StartWait(),
			// I seem to be observing the debugger break on the source of the exception, even
			// with BeginInvoke/EndInvoke, so I would like a conter-example.
			//example of BeginInvoke/EndInvoke breaking on exception source: if I insert:
			// if (System.Windows.Forms.MessageBox.Show("Now?", "CRASH", System.Windows.Forms.MessageBoxButtons.YesNo) == System.Windows.Forms.DialogResult.Yes)
			//		throw new DirectoryNotFoundException("DUMMY");
			// as the first line of Archive.public byte[] GetFileContents(string p_strPath)
			// StartWait() breaks on said line.

			/*Func<object, object> dlg = new Func<object, object>(RunThreadedWork);
			IAsyncResult ar = dlg.BeginInvoke(p_objArgs, EndThreadInvokeHandler, p_objArgs);*/

			TrackedThread thdWork = new TrackedThread(RunThread);
			thdWork.Thread.IsBackground = p_booRunInBackground;
			thdWork.Start(p_objArgs);
		}
All Usage Examples Of Nexus.Client.Util.Threading.TrackedThread::Start