Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/lib/librumpuser Clear rwlock's "writer" field when releasing...
details: https://anonhg.NetBSD.org/src/rev/54ccedc28384
branches: trunk
changeset: 786583:54ccedc28384
user: pooka <pooka%NetBSD.org@localhost>
date: Thu May 02 16:49:08 2013 +0000
description:
Clear rwlock's "writer" field when releasing the lock. Otherwise it might
have been possible for "readers" to reach visibility before "writer"
when another CPU took the lock, thus leading the previous owner to
incorrectly think that it still owned the lock in rw_write_held().
Also, remove duplicate clause from assert().
diffstat:
lib/librumpuser/rumpuser_pth.c | 7 ++++---
1 files changed, 4 insertions(+), 3 deletions(-)
diffs (29 lines):
diff -r 5573a96a0d39 -r 54ccedc28384 lib/librumpuser/rumpuser_pth.c
--- a/lib/librumpuser/rumpuser_pth.c Thu May 02 15:32:19 2013 +0000
+++ b/lib/librumpuser/rumpuser_pth.c Thu May 02 16:49:08 2013 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: rumpuser_pth.c,v 1.21 2013/04/30 13:29:28 pooka Exp $ */
+/* $NetBSD: rumpuser_pth.c,v 1.22 2013/05/02 16:49:08 pooka Exp $ */
/*
* Copyright (c) 2007-2010 Antti Kantee. All Rights Reserved.
@@ -28,7 +28,7 @@
#include "rumpuser_port.h"
#if !defined(lint)
-__RCSID("$NetBSD: rumpuser_pth.c,v 1.21 2013/04/30 13:29:28 pooka Exp $");
+__RCSID("$NetBSD: rumpuser_pth.c,v 1.22 2013/05/02 16:49:08 pooka Exp $");
#endif /* !lint */
#include <assert.h>
@@ -65,8 +65,9 @@
} while (/*CONSTCOND*/0)
#define RURW_CLRWRITE(rw) \
do { \
- assert(rw->readers == -1 && RURW_AMWRITER(rw)); \
+ assert(RURW_AMWRITER(rw)); \
rw->readers = 0; \
+ rw->writer = NULL; \
} while (/*CONSTCOND*/0)
#define RURW_INCREAD(rw) \
do { \
Home |
Main Index |
Thread Index |
Old Index