Source-Changes-HG archive

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

[src/trunk]: src/lib/librumpuser need the rw_downgrade/tryupgrade methods too



details:   https://anonhg.NetBSD.org/src/rev/71c0e37816fa
branches:  trunk
changeset: 786689:71c0e37816fa
user:      pooka <pooka%NetBSD.org@localhost>
date:      Tue May 07 16:40:31 2013 +0000

description:
need the rw_downgrade/tryupgrade methods too

diffstat:

 lib/librumpuser/rumpuser_pth_dummy.c |  24 ++++++++++++++++++++++--
 1 files changed, 22 insertions(+), 2 deletions(-)

diffs (45 lines):

diff -r 6e00855aed68 -r 71c0e37816fa lib/librumpuser/rumpuser_pth_dummy.c
--- a/lib/librumpuser/rumpuser_pth_dummy.c      Tue May 07 16:18:48 2013 +0000
+++ b/lib/librumpuser/rumpuser_pth_dummy.c      Tue May 07 16:40:31 2013 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: rumpuser_pth_dummy.c,v 1.14 2013/05/07 15:37:05 pooka Exp $    */
+/*     $NetBSD: rumpuser_pth_dummy.c,v 1.15 2013/05/07 16:40:31 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.14 2013/05/07 15:37:05 pooka Exp $");
+__RCSID("$NetBSD: rumpuser_pth_dummy.c,v 1.15 2013/05/07 16:40:31 pooka Exp $");
 #endif /* !lint */
 
 #include <sys/time.h>
@@ -209,6 +209,26 @@
        }
 }
 
+void
+rumpuser_rw_downgrade(struct rumpuser_rw *rw)
+{
+
+       assert(rw->v == 1);
+       rw->v = -1;
+}
+
+int
+rumpuser_rw_tryupgrade(struct rumpuser_rw *rw)
+{
+
+       if (rw->v == -1) {
+               rw->v = 1;
+               return 0;
+       }
+
+       return EBUSY;
+}
+
 /*ARGSUSED*/
 void
 rumpuser_cv_init(struct rumpuser_cv **cv)



Home | Main Index | Thread Index | Old Index