Пример #1
0
        public void Process()
        {
            Log.Debug("ThreadExecutor", "[" + ThreadID + "] Processing ...");

            while (IsRunning)
            {
                if (ProcessEvent != null)
                {
                    Processing = true;
                    long StartTime = TCPManager.GetTimeStampMS();

                    try
                    {
                        ProcessEvent.Invoke(this);
                    }
                    catch (Exception e)
                    {
                        Log.Error("ThreadExecutor", e.ToString());
                    }

                    long Elapsed = TCPManager.GetTimeStampMS() - StartTime;

                    Processing   = false;
                    ProcessEvent = null;

                    if (Elapsed < WaitTimeMS && IsRunning)
                    {
                        Thread.Sleep((int)(WaitTimeMS - Elapsed));
                    }
                }
                else if (IsRunning)
                {
                    Thread.Sleep(WaitTimeMS);
                }
            }

            Log.Debug("ThreadExecutor", "Process Stop : " + ThreadID);
        }
Пример #2
0
 public override void Process(uint operation, object args)
 {
     process?.Invoke(operation, args);
 }
Пример #3
0
 public string Process(string str)
 {
     return(ProcessDele.Invoke() + str + NewLine + NewSection);
 }