コード例 #1
0
 private void CheckThreadState(ref Thread thread, ref int threadIL, Crestron.SimplSharpPro.CrestronThread.ThreadCallbackFunction method, string methodname)
 {
     if (fw.EventsEnabled)
     {
         if (Interlocked.CompareExchange(ref threadIL, 1, 0) == 0)
         {
             thread = new Thread(method, null, Thread.eThreadStartOptions.Running);
         }
         else
         {
             //CrestronConsole.PrintLine("- didn't start new " + methodname + " - thread already running");
         }
     }
 }
コード例 #2
0
 public ThreadEx(Crestron.SimplSharpPro.CrestronThread.ThreadCallbackFunction threadCallbackFunc, object userDefinedObject,
                 Crestron.SimplSharpPro.CrestronThread.Thread.eThreadStartOptions threadStartOption)
     : base(threadCallbackFunc, userDefinedObject, threadStartOption)
 {
     _threadExId = Interlocked.Increment(ref _lastExId) | (long)(_threadExId == 0 ? Interlocked.Increment(ref _lastExIdHigh) : _lastExIdHigh) << 32;
 }