Esempio n. 1
0
 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);
             }
         }
     }
 }
Esempio n. 2
0
 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());
     }
 }
Esempio n. 3
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);
            }
        }
Esempio n. 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 ());
 }
Esempio n. 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);
        }