RPM Community Forums

Mailing List Message of <rpm-devel>

robust mutexes patch for glibc/kernel w/o robust mutexes

From: Jeff Johnson <n3npq@mac.com>
Date: Sun 29 Jul 2007 - 16:36:50 CEST
Message-Id: <8C25C4B1-DFF8-4692-833C-E99286C84C00@mac.com>
Not setting the return code from pthread_mutexattr_setrobust_np()
is likely the fix for interoperability with glibc/kernel that does not
support robust mutexes but does define EOWNERDEAD:

+#if defined(EOWNERDEAD)
  		RET_SET((pthread_mutexattr_init(&mutexattr)), ret);
+		if (ret == 0) {
+			RET_SET((pthread_mutexattr_setrobust_np(
+			    &mutexattr, PTHREAD_MUTEX_ROBUST_NP)), ret);
+		}
+#endif

The other two returns should never return EOWNERDEAD if robust
mutexes are not supported:

@@ -196,6 +202,12 @@
  #endif

  	RET_SET((pthread_mutex_lock(&mutexp->mutex)), ret);
+#if defined(EOWNERDEAD)
+	if (ret == EOWNERDEAD) {
+		RET_SET((pthread_mutex_consistent_np(&mutexp->mutex)), ret);
+		ret = 0;
+	}
+#endif
  	if (ret != 0)
  		goto err;

@@ -306,6 +318,12 @@
  #endif
  	if (F_ISSET(mutexp, DB_MUTEX_SELF_BLOCK)) {
  		RET_SET((pthread_mutex_lock(&mutexp->mutex)), ret);
+#if defined(EOWNERDEAD)
+		if (ret == EOWNERDEAD) {
+			RET_SET((pthread_mutex_consistent_np(&mutexp->mutex)), ret);
+			ret = 0;
+		}
+#endif
  		if (ret != 0)
  			goto err;



hth

73 de Jeff
Received on Sun Jul 29 16:37:01 2007
Driven by Jeff Johnson and the RPM project team.
Hosted by OpenPKG and Ralf S. Engelschall.
Powered by FreeBSD and OpenPKG.