コード例 #1
0
ファイル: DispatchService.cs プロジェクト: tabrath/meshwork
 static void backgroundDispatcher()
 {
     // FIXME: use an event to avoid active wait
     while (true)
     {
         if (arrBackgroundQueue.Count == 0)
         {
             Thread.Sleep(500);
             //thrBackground.Suspend ();
             continue;
         }
         GenericMessageContainer msg = null;
         lock (arrBackgroundQueue) {
             msg = (GenericMessageContainer)arrBackgroundQueue[0];
             arrBackgroundQueue.RemoveAt(0);
         }
         if (msg != null)
         {
             msg.Run();
             if (msg.Exception != null)
             {
                 HandlerError(msg);
             }
         }
     }
 }
コード例 #2
0
ファイル: DispatchService.cs プロジェクト: tabrath/meshwork
 static void HandlerError(GenericMessageContainer msg)
 {
     if (msg.CallerStack != null)
     {
         Core.LoggingService.LogError("{0} {1}\nCaller stack:{2}", errormsg, msg.Exception.ToString(), msg.CallerStack);
     }
     else
     {
         Core.LoggingService.LogError("{0} {1}\nCaller stack not available. Define the environment variable MONODEVELOP_DISPATCH_DEBUG to enable caller stack capture.", errormsg, msg.Exception.ToString());
     }
 }
コード例 #3
0
ファイル: DispatchService.cs プロジェクト: tabrath/meshwork
        public static void GuiSyncDispatch(MessageHandler cb)
        {
            if (IsGuiThread)
            {
                cb();
                return;
            }

            GenericMessageContainer mc = new GenericMessageContainer(cb, true);

            lock (mc) {
                QueueMessage(mc);
                Monitor.Wait(mc);
            }
            if (mc.Exception != null)
            {
                throw new Exception(errormsg, mc.Exception);
            }
        }
コード例 #4
0
 static void HandlerError(GenericMessageContainer msg)
 {
     if (msg.CallerStack != null) {
         LoggingService.LogError ("{0} {1}\nCaller stack:{2}", errormsg, msg.Exception.ToString (), msg.CallerStack);
     }
     else
         LoggingService.LogError ("{0} {1}\nCaller stack not available. Define the environment variable MONODEVELOP_DISPATCH_DEBUG to enable caller stack capture.", errormsg, msg.Exception.ToString ());
 }
コード例 #5
0
        public static void GuiSyncDispatch(MessageHandler cb)
        {
            if (IsGuiThread) {
                cb ();
                return;
            }

            GenericMessageContainer mc = new GenericMessageContainer (cb, true);
            lock (mc) {
                QueueMessage (mc);
                Monitor.Wait (mc);
            }
            if (mc.Exception != null)
                throw new Exception (errormsg, mc.Exception);
        }