Module Name: src
Committed By: pooka
Date: Tue Sep 8 20:04:03 UTC 2009
Modified Files:
src/sys/rump/librump/rumpuser: rumpuser_pth.c
Log Message:
Use PTHREAD_MUTEX_ERRORCHECK. This enables rump deadlock detection
once again:
panic: rumpuser fatal failure 11 (Resource deadlock avoided)
To generate a diff of this commit:
cvs rdiff -u -r1.34 -r1.35 src/sys/rump/librump/rumpuser/rumpuser_pth.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/sys/rump/librump/rumpuser/rumpuser_pth.c
diff -u src/sys/rump/librump/rumpuser/rumpuser_pth.c:1.34 src/sys/rump/librump/rumpuser/rumpuser_pth.c:1.35
--- src/sys/rump/librump/rumpuser/rumpuser_pth.c:1.34 Tue Jul 14 21:00:53 2009
+++ src/sys/rump/librump/rumpuser/rumpuser_pth.c Tue Sep 8 20:04:03 2009
@@ -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;
}