Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/rump/librump/rumpuser Use PTHREAD_MUTEX_ERRORCHECK. Thi...



details:   https://anonhg.NetBSD.org/src/rev/dd94d85df6e2
branches:  trunk
changeset: 747291:dd94d85df6e2
user:      pooka <pooka%NetBSD.org@localhost>
date:      Tue Sep 08 20:04:03 2009 +0000

description:
Use PTHREAD_MUTEX_ERRORCHECK.  This enables rump deadlock detection
once again:
panic: rumpuser fatal failure 11 (Resource deadlock avoided)

diffstat:

 sys/rump/librump/rumpuser/rumpuser_pth.c |  13 ++++++++++---
 1 files changed, 10 insertions(+), 3 deletions(-)

diffs (35 lines):

diff -r b17e38650f35 -r dd94d85df6e2 sys/rump/librump/rumpuser/rumpuser_pth.c
--- a/sys/rump/librump/rumpuser/rumpuser_pth.c  Tue Sep 08 18:35:42 2009 +0000
+++ b/sys/rump/librump/rumpuser/rumpuser_pth.c  Tue Sep 08 20:04:03 2009 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: rumpuser_pth.c,v 1.34 2009/07/14 21:00:53 apb Exp $    */
+/*     $NetBSD: rumpuser_pth.c,v 1.35 2009/09/08 20:04:03 pooka Exp $  */
 
 /*
  * Copyright (c) 2007 Antti Kantee.  All Rights Reserved.
@@ -30,7 +30,7 @@
 
 #include <sys/cdefs.h>
 #if !defined(lint)
-__RCSID("$NetBSD: rumpuser_pth.c,v 1.34 2009/07/14 21:00:53 apb Exp $");
+__RCSID("$NetBSD: rumpuser_pth.c,v 1.35 2009/09/08 20:04:03 pooka Exp $");
 #endif /* !lint */
 
 #ifdef __linux__
@@ -237,8 +237,15 @@
 void
 rumpuser_mutex_init(struct rumpuser_mtx **mtx)
 {
+       pthread_mutexattr_t att;
+
        NOFAIL(*mtx = malloc(sizeof(struct rumpuser_mtx)));
-       NOFAIL_ERRNO(pthread_mutex_init(&((*mtx)->pthmtx), NULL));
+
+       pthread_mutexattr_init(&att);
+       pthread_mutexattr_settype(&att, PTHREAD_MUTEX_ERRORCHECK);
+       NOFAIL_ERRNO(pthread_mutex_init(&((*mtx)->pthmtx), &att));
+       pthread_mutexattr_destroy(&att);
+
        (*mtx)->owner = NULL;
        (*mtx)->recursion = 0;
 }



Home | Main Index | Thread Index | Old Index