$OpenBSD: patch-kdecore_util_kshareddatacache_p_h,v 1.1 2013/12/08 19:13:32 zhuk Exp $
--- kdecore/util/kshareddatacache_p.h.orig	Fri Jun 28 21:03:40 2013
+++ kdecore/util/kshareddatacache_p.h	Fri Dec  6 14:00:45 2013
@@ -102,9 +102,8 @@ class KSDCLock { (public)
 
     // Return value indicates if the mutex was properly initialized (including
     // threads-only as a fallback).
-    virtual bool initialize(bool &processSharingSupported)
+    virtual bool initialize()
     {
-        processSharingSupported = false;
         return false;
     }
 
@@ -131,11 +130,10 @@ class simpleSpinLock : public KSDCLock (public)
     {
     }
 
-    virtual bool initialize(bool &processSharingSupported)
+    virtual bool initialize()
     {
         // Clear the spinlock
         m_spinlock = 0;
-        processSharingSupported = true;
         return true;
     }
 
@@ -190,29 +188,21 @@ class pthreadLock : public KSDCLock (public)
     {
     }
 
-    virtual bool initialize(bool &processSharingSupported)
+    virtual bool initialize()
     {
         // Setup process-sharing.
         pthread_mutexattr_t mutexAttr;
-        processSharingSupported = false;
 
         // Initialize attributes, enable process-shared primitives, and setup
         // the mutex.
         if (::sysconf(_SC_THREAD_PROCESS_SHARED) >= 200112L && pthread_mutexattr_init(&mutexAttr) == 0) {
             if (pthread_mutexattr_setpshared(&mutexAttr, PTHREAD_PROCESS_SHARED) == 0 &&
                 pthread_mutex_init(&m_mutex, &mutexAttr) == 0)
-            {
-                processSharingSupported = true;
-            }
             pthread_mutexattr_destroy(&mutexAttr);
+            return true;
         }
 
-        // Attempt to setup for thread-only synchronization.
-        if (!processSharingSupported && pthread_mutex_init(&m_mutex, NULL) != 0) {
-            return false;
-        }
-
-        return true;
+        return false;
     }
 
     virtual bool lock()
@@ -263,23 +253,18 @@ class semaphoreLock : public KSDCLock (public)
     {
     }
 
-    virtual bool initialize(bool &processSharingSupported)
+    virtual bool initialize()
     {
-        processSharingSupported = false;
         if (::sysconf(_SC_SEMAPHORES) < 200112L) {
             return false;
         }
 
         // sem_init sets up process-sharing for us.
         if (sem_init(&m_semaphore, 1, 1) == 0) {
-            processSharingSupported = true;
+            return true;
         }
-        // If not successful try falling back to thread-shared.
-        else if (sem_init(&m_semaphore, 0, 1) != 0) {
-            return false;
-        }
 
-        return true;
+        return false;
     }
 
     virtual bool lock()
@@ -363,9 +348,10 @@ struct SharedLock
  */
 static SharedLockId findBestSharedLock()
 {
+#if 0
     // We would prefer a process-shared capability that also supports
     // timeouts. Failing that, process-shared is preferred over timeout
-    // support. Failing that we'll go thread-local
+    // support. Failing that we'll go with spinning lock.
     bool timeoutsSupported = false;
     bool pthreadsProcessShared = false;
     bool semaphoresProcessShared = false;
@@ -389,7 +375,7 @@ static SharedLockId findBestSharedLock()
             tempLock = QSharedPointer<KSDCLock>(new pthreadLock(tempMutex));
         }
 
-        tempLock->initialize(pthreadsProcessShared);
+        pthreadsProcessShared = tempLock->initialize();
     }
 #endif
 
@@ -409,7 +395,7 @@ static SharedLockId findBestSharedLock()
             tempLock = QSharedPointer<KSDCLock>(new semaphoreLock(tempSemaphore));
         }
 
-        tempLock->initialize(semaphoresProcessShared);
+        semaphoresProcessShared = tempLock->initialize();
     }
 #endif
 
@@ -422,6 +408,7 @@ static SharedLockId findBestSharedLock()
     else if(semaphoresProcessShared) {
         return LOCKTYPE_SEMAPHORE;
     }
+#endif    // 0
 
     // Fallback to a dumb-simple but possibly-CPU-wasteful solution.
     return LOCKTYPE_SPINLOCK;
