[Top][All Lists]

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

[PATCH gnumach 2/2] ipc: use a general lock to protect IPC spaces

From: Justus Winter
Subject: [PATCH gnumach 2/2] ipc: use a general lock to protect IPC spaces
Date: Wed, 15 Jul 2015 15:24:30 +0200

This fixes a corruption in the radix trees representing the IPC spaces
when memory was tight.

* ipc/ipc_space.h: Use a general lock to protect IPC spaces.
 ipc/ipc_space.h | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/ipc/ipc_space.h b/ipc/ipc_space.h
index bbfee46..73c90ef 100644
--- a/ipc/ipc_space.h
+++ b/ipc/ipc_space.h
@@ -62,7 +62,7 @@ struct ipc_space {
        ipc_space_refs_t is_references;
-       decl_simple_lock_data(,is_lock_data)
+       struct lock is_lock_data;
        boolean_t is_active;            /* is the space alive? */
        struct rdxtree is_map;          /* a map of entries */
        size_t is_size;                 /* number of entries */
@@ -107,16 +107,16 @@ MACRO_BEGIN                                               
                is_free(is);                                            \
-#define        is_lock_init(is)        simple_lock_init(&(is)->is_lock_data)
+#define        is_lock_init(is)        lock_init(&(is)->is_lock_data, TRUE)
-#define        is_read_lock(is)        simple_lock(&(is)->is_lock_data)
-#define is_read_unlock(is)     simple_unlock(&(is)->is_lock_data)
+#define        is_read_lock(is)        lock_read(&(is)->is_lock_data)
+#define is_read_unlock(is)     lock_done(&(is)->is_lock_data)
-#define        is_write_lock(is)       simple_lock(&(is)->is_lock_data)
-#define        is_write_lock_try(is)   simple_lock_try(&(is)->is_lock_data)
-#define is_write_unlock(is)    simple_unlock(&(is)->is_lock_data)
+#define        is_write_lock(is)       lock_write(&(is)->is_lock_data)
+#define        is_write_lock_try(is)   lock_try_write(&(is)->is_lock_data)
+#define is_write_unlock(is)    lock_done(&(is)->is_lock_data)
-#define        is_write_to_read_lock(is)
+#define        is_write_to_read_lock(is) 
 extern void ipc_space_reference(struct ipc_space *space);
 extern void ipc_space_release(struct ipc_space *space);

reply via email to

[Prev in Thread] Current Thread [Next in Thread]