Index: /trunk/MagicSoft/Mars/mbase/MLog.cc
===================================================================
--- /trunk/MagicSoft/Mars/mbase/MLog.cc	(revision 4252)
+++ /trunk/MagicSoft/Mars/mbase/MLog.cc	(revision 4253)
@@ -361,5 +361,9 @@
 
     // lock mutex
-    LockUpdate("UpdateGui");
+    if (!LockUpdate("UpdateGui"))
+    {
+        Warning("UpdateGui", "Execution skipped");
+        return;
+    }
 
     TGText &txt=*fGui->GetText();
@@ -392,33 +396,55 @@
 }
 
-void MLog::LockUpdate(const char *msg)
+bool MLog::LockUpdate(const char *msg)
 {
 #ifdef _REENTRANT
     if (fMuxGui->Lock()==13)
-        Error("LockUpdate", "%s - mutex is already locked by this thread\n", msg);
-#endif
-}
-
-void MLog::UnLockUpdate(const char *msg)
+    {
+        Info("LockUpdate", "%s - mutex is already locked by this thread\n", msg);
+        return false;
+    }
+    return true;
+#endif
+}
+
+bool MLog::UnLockUpdate(const char *msg)
 {
 #ifdef _REENTRANT
     if (fMuxGui->UnLock()==13)
-        Error("UnLockUpdate", "%s - tried to unlock mutex locked by other thread\n", msg);
-#endif
-}
-
-void MLog::Lock(const char *msg)
+    {
+        Info("UnLockUpdate", "%s - tried to unlock mutex locked by other thread\n", msg);
+        return false;
+    }
+    return true;
+#endif
+}
+
+bool MLog::Lock(const char *msg)
 {
 #ifdef _REENTRANT
     if (fMuxStream->Lock()==13)
+    {
         Error("Lock", "%s - mutex is already locked by this thread\n", msg);
-#endif
-}
-
-void MLog::UnLock(const char *msg)
+        return false;
+    }
+//    while (fMuxStream->Lock()==13)
+//        usleep(1);
+//    {
+//        Error("Lock", "%s - mutex is already locked by this thread\n", msg);
+//        return false;
+//    }
+    return true;
+#endif
+}
+
+bool MLog::UnLock(const char *msg)
 {
 #ifdef _REENTRANT
     if (fMuxStream->UnLock()==13)
+    {
         Error("UnLock", "%s - tried to unlock mutex locked by other thread\n", msg);
+        return false;
+    }
+    return true;
 #endif
 }
@@ -430,5 +456,6 @@
 int MLog::sync()
 {
-    LockUpdate("sync");
+    if (!LockUpdate("sync"))
+        usleep(1);
     WriteBuffer();
     UnLockUpdate("sync");
@@ -466,5 +493,6 @@
     if (fOutputLevel <= fDebugLevel)
     {
-        LockUpdate("overflow");
+        if (!LockUpdate("overflow"))
+            usleep(1);
 
         *fPPtr++ = (char)i;
Index: /trunk/MagicSoft/Mars/mbase/MLog.h
===================================================================
--- /trunk/MagicSoft/Mars/mbase/MLog.h	(revision 4252)
+++ /trunk/MagicSoft/Mars/mbase/MLog.h	(revision 4253)
@@ -103,9 +103,9 @@
     ~MLog();
 
-    void LockUpdate(const char *msg);
-    void UnLockUpdate(const char *msg);
-
-    void Lock(const char *msg="");
-    void UnLock(const char *msg="");
+    bool LockUpdate(const char *msg);
+    bool UnLockUpdate(const char *msg);
+
+    bool Lock(const char *msg="");
+    bool UnLock(const char *msg="");
 
     void EnableDirectGui()  { fIsDirectGui = kTRUE; }
