diff options
author | Justus Winter <4winter@informatik.uni-hamburg.de> | 2015-07-15 12:40:50 +0200 |
---|---|---|
committer | Justus Winter <4winter@informatik.uni-hamburg.de> | 2015-07-15 15:23:14 +0200 |
commit | 7c9b83c90e2acc4f9eb74713c47796a3c0a08800 (patch) | |
tree | ab425b08c403d2f10107accf1f2c34fa6b4a94f1 | |
parent | 8a68e0a6f3a62c3e382791774e5feb9506e1f7d8 (diff) |
ipc: use a general lock to protect IPC spaces
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.
-rw-r--r-- | ipc/ipc_space.h | 16 |
1 files 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 { decl_simple_lock_data(,is_ref_lock_data) 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); \ MACRO_END -#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) lock_write_to_read(&(is)->is_lock_data) extern void ipc_space_reference(struct ipc_space *space); extern void ipc_space_release(struct ipc_space *space); |