Index: trunk/FACT++/src/MessageDim.cc
===================================================================
--- trunk/FACT++/src/MessageDim.cc	(revision 10940)
+++ trunk/FACT++/src/MessageDim.cc	(revision 10941)
@@ -68,20 +68,41 @@
 int MessageDimTX::Write(const Time &t, const string &txt, int qos)
 {
-    static mutex mtx;
+    MessageImp::Write(t, txt, qos);
 
-    mtx.lock();
 
-    MessageImp::Write(t, txt, qos);
+    // We cannot use our own mutex here because it can create dead-locks
+    // in a hand-shake with the global dim-mutex if a service is
+    // updated from within a dimHandler (dim-mutex already locked)
+    // and at the same time another thread tries to lock the mutex.
+    //
+    // Thread 1: Lock global Dim mutex and call infoHandler
+    //
+    // Thread 2: CALL Write
+    // Thread 2: LOCK Write-mutex
+    // Thread 2: setQuality will try to lock global Dim mutex
+    //           (since Thread1!=Thread2 this results in a wait)
+    //
+    // Thread 1: CALL Write from within the infoHandler
+    // Thread 1: LOCK Write-mutex
+    //           (since Thread2 now waits for the infoHandler to finish
+    //            and the infoHandler has to wait for the Write-mutex
+    //            we have a dead-lock)
+    //
+    extern void dim_lock();
+    extern void dim_unlock();
+
+    dim_lock();
 
     // We have to use setData to make sure the DimService will
     // hold a local copy of the data.
+    setData(const_cast<char*>(txt.c_str()));
     setQuality(qos);
-    setData(const_cast<char*>(txt.c_str()));
+
     const int rc = updateService();
+
+    dim_unlock();
 
     if (rc==0 && fDebug)
         Out() << " !! " << t.GetAsStr() << " - Sending failed!" << endl;
-
-    mtx.unlock();
 
     return rc;
