Module Name: src Committed By: pooka Date: Fri Nov 2 16:55:02 UTC 2012
Modified Files: src/lib/librumpuser: rumpuser_pth_dummy.c Log Message: implement mutex_owner() To generate a diff of this commit: cvs rdiff -u -r1.4 -r1.5 src/lib/librumpuser/rumpuser_pth_dummy.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/lib/librumpuser/rumpuser_pth_dummy.c diff -u src/lib/librumpuser/rumpuser_pth_dummy.c:1.4 src/lib/librumpuser/rumpuser_pth_dummy.c:1.5 --- src/lib/librumpuser/rumpuser_pth_dummy.c:1.4 Fri Nov 2 13:31:26 2012 +++ src/lib/librumpuser/rumpuser_pth_dummy.c Fri Nov 2 16:55:02 2012 @@ -1,4 +1,4 @@ -/* $NetBSD: rumpuser_pth_dummy.c,v 1.4 2012/11/02 13:31:26 pooka Exp $ */ +/* $NetBSD: rumpuser_pth_dummy.c,v 1.5 2012/11/02 16:55:02 pooka Exp $ */ /* * Copyright (c) 2009 Antti Kantee. All Rights Reserved. @@ -29,7 +29,7 @@ #include <sys/cdefs.h> #if !defined(lint) -__RCSID("$NetBSD: rumpuser_pth_dummy.c,v 1.4 2012/11/02 13:31:26 pooka Exp $"); +__RCSID("$NetBSD: rumpuser_pth_dummy.c,v 1.5 2012/11/02 16:55:02 pooka Exp $"); #endif /* !lint */ #include <sys/time.h> @@ -45,10 +45,13 @@ __RCSID("$NetBSD: rumpuser_pth_dummy.c,v #include "rumpuser_int.h" +static struct lwp *curlwp; + struct rumpuser_cv {}; struct rumpuser_mtx { int v; + struct lwp *o; }; struct rumpuser_rw { @@ -116,6 +119,7 @@ rumpuser_mutex_enter(struct rumpuser_mtx { mtx->v++; + mtx->o = curlwp; } int @@ -130,7 +134,9 @@ void rumpuser_mutex_exit(struct rumpuser_mtx *mtx) { - mtx->v--; + assert(mtx->v > 0); + if (--mtx->v == 0) + mtx->o = NULL; } void @@ -140,6 +146,13 @@ rumpuser_mutex_destroy(struct rumpuser_m free(mtx); } +struct lwp * +rumpuser_mutex_owner(struct rumpuser_mtx *mtx) +{ + + return mtx->o; +} + void rumpuser_rw_init(struct rumpuser_rw **rw) { @@ -271,7 +284,6 @@ rumpuser_cv_has_waiters(struct rumpuser_ * curlwp */ -static struct lwp *curlwp; void rumpuser_set_curlwp(struct lwp *l) {