/// <summary> /// Default Constructor /// </summary> /// <param name="fileName">name of log file</param> /// <param name="encodingType">encoding type</param> public LogWorker(string fileName, Encoding encodingType = null) : base(encodingType) { m_fileName = fileName; m_thread = new ThreadEx(this.execute, ThreadPriority.Normal); m_thread.Start(); }
/// <summary> /// Default copy constructor /// </summary> /// <param name="b">the object to copy from</param> public ThreadEx(ThreadEx b) { m_threadFunc = b.m_threadFunc; m_threadParameterizedFunc = b.m_threadParameterizedFunc; m_parameter = b.m_parameter; if (m_threadFunc != null || m_parentThreadHandle != null) { m_parentThreadHandle = b.m_parentThreadHandle; m_threadHandle = b.m_threadHandle; m_status = b.m_status; m_exitCode = b.m_exitCode; b.m_parentThreadHandle = null; b.m_threadHandle = null; b.m_status = ThreadStatus.TERMINATED; b.m_exitCode = 0; } else { m_threadHandle = null; m_parentThreadHandle = null; m_exitCode = 0; m_status = ThreadStatus.TERMINATED; } }
/// <summary> /// Entry point for the thread /// </summary> /// <param name="pThis">The argument for the thread (this for current case)</param> private static void entryPoint(object pThis) { ThreadEx pt = (ThreadEx)pThis; pt.run(); }