示例#1
0
 /// <summary>
 /// Initializes a new instance of the <see cref="MonitoredThread"/> class.
 /// </summary>
 /// <param name="timeout">The timeout.</param>
 /// <param name="message">The message.</param>
 /// <param name="eventID">The event ID.</param>
 /// <param name="process">The process.</param>
 /// <param name="processName">Name of the process.</param>
 /// <param name="isBackground">if set to <c>true</c> [is background].</param>
 /// <param name="priority">The priority.</param>
 public MonitoredThread(ushort timeout, string message, int eventID, ThreadStart process, string processName, bool isBackground, ThreadPriority priority)
 {
     myEventLog = new EventLogMonitor("Time out error: " + message, EventLogEntryType.Error, 2000 + eventID, 0);
     ResetWatchDog(short.MaxValue, timeout);
     Name = processName;
     lock (threadsList)
         threadsList.Add(this);
     m_Thread = Manager.StartProcess(process, processName, isBackground, priority);
 }
示例#2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="Assertion"/> class.
        /// </summary>
        /// <param name="message">The message.</param>
        /// <param name="eventID">The event ID.</param>
        /// <param name="rebootRequired">if set to <c>true</c> system reboot is required.</param>
        public Assertion(string message, int eventID, bool rebootRequired) : base(message)
        {
            EventLogEntryType severity;

            if (rebootRequired)
            {
                severity = EventLogEntryType.Error;
            }
            else
            {
                severity = EventLogEntryType.Warning;
            }
            m_EventLog = new EventLogMonitor("Assertion error:" + message, severity, 1000 + eventID, 0);
        }
示例#3
0
 /// <summary>
 /// The main thread that executes handlers.
 /// </summary>
 private void QueueHandler(object parameters)
 {
     try
     {
         TElement _decriptor = RemoveItem(m_Autoreset);
         if (_decriptor == null)
         {
             return;
         }
         Handler(_decriptor);
     }
     catch (Exception ex)
     {
         string message = $"Exception has beet catch: {ex.Message}  at {ex.Source} with call stack {ex.StackTrace}";
         EventLogMonitor.WriteToEventLogError(message, 42);
     }
     finally { m_Busy = false; }
 }