All pastes #1058325 Raw Edit

qmutex_unix.cpp.1.diff

public diff v1 · immutable
#1058325 ·published 2008-06-29 18:23 UTC
rendered paste body
--- qt-4.4.0.orig/src/corelib/thread/qmutex_unix.cpp	2008-04-28 09:11:18.000000000 -0400+++ qt-4.4.0/src/corelib/thread/qmutex_unix.cpp	2008-06-29 14:02:35.441137000 -0400@@ -63,8 +63,47 @@ QMutexPrivate::QMutexPrivate(QMutex::RecursionMode mode)     : recursive(mode == QMutex::Recursive), contenders(0), owner(0), count(0), wakeup(false) {+#if defined(Q_OS_SOLARIS)+    pthread_mutexattr_t mutex_attr;+    pthread_condattr_t cond_attr;+    report_error(pthread_mutexattr_init(&mutex_attr),+            "QMutex", "mutex attr init");+    report_error(pthread_condattr_init(&cond_attr),+            "QMutex", "cond attr init");+    /* The default type for a pthread_mutexattr_t is+     * PTHREAD_PROCESS_PRIVATE.+     */+    report_error(pthread_mutexattr_setpshared(&mutex_attr,+                PTHREAD_PROCESS_SHARED),+            "QMutex", "mutex attr setpshared");++    /* The default type for a pthread_condattr_t is+     * PTHREAD_PROCESS_PRIVATE.+     */+    report_error(pthread_condattr_setpshared(&cond_attr,+                PTHREAD_PROCESS_SHARED),+            "QMutex", "cond attr setpshared");++    /* It is illegal to use a pthread_mutex_t with a type of+     * PTHREAD_MUTEX_RECURSIVE in conjunction with a pthread_cond_t.+     * A recursive pthread_mutex_t will not correctly perform the+     * implicit atomic pthread_mutex_lock/pthread_mutex_unlock+     * guaranteed by the implementation of pthread_cond_wait.+     * Therfore we enforce a pthread_mutexattr_t type of+     * PTHREAD_MUTEX_ERRORCHECK, and we do not use the default+     * pthread_mutexattr_t attributes.+     */+    report_error(pthread_mutexattr_settype(&mutex_attr,+                PTHREAD_MUTEX_ERRORCHECK),+            "QMutex", "mutex attr setttype");+    report_error(pthread_mutex_init(&mutex, &mutex_attr),+            "QMutex", "mutex init");+    report_error(pthread_cond_init(&cond, &cond_attr),+            "QMutex", "cond init");+#else     report_error(pthread_mutex_init(&mutex, NULL), "QMutex", "mutex init");     report_error(pthread_cond_init(&cond, NULL), "QMutex", "cv init");+#endif }  QMutexPrivate::~QMutexPrivate()