예제 #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);
 }