diff options
author | Richard Braun <rbraun@sceen.net> | 2017-06-30 23:15:35 +0200 |
---|---|---|
committer | Richard Braun <rbraun@sceen.net> | 2017-06-30 23:15:35 +0200 |
commit | 1edbaa9f03a118dabf3e6a53f0a60e1f0bf9690a (patch) | |
tree | 7a0f75ea694be48a0189524eadd0f1da20cf02e6 | |
parent | dde74d4334a874ed25141d474d981631a244d54c (diff) |
rdxtree: provide a lockless-aware slot load accessor
-rw-r--r-- | rdxtree.c | 7 | ||||
-rw-r--r-- | rdxtree.h | 13 |
2 files changed, 13 insertions, 7 deletions
@@ -76,13 +76,6 @@ typedef unsigned long long rdxtree_bm_t; ((~(rdxtree_bm_t)0) >> (RDXTREE_BM_SIZE - RDXTREE_RADIX_SIZE)) /* - * These macros can be replaced by actual functions in an environment - * that provides lockless synchronization such as RCU. - */ -#define llsync_assign_ptr(ptr, value) ((ptr) = (value)) -#define llsync_read_ptr(ptr) (ptr) - -/* * Radix tree node. * * The height of a tree is the number of nodes to traverse until stored @@ -39,6 +39,13 @@ #include <stdint.h> /* + * These macros can be replaced by actual functions in an environment + * that provides lockless synchronization such as RCU. + */ +#define llsync_assign_ptr(ptr, value) ((ptr) = (value)) +#define llsync_read_ptr(ptr) (ptr) + +/* * This macro selects between 32 or 64-bits (the default) keys. */ #if 0 @@ -174,6 +181,12 @@ rdxtree_lookup_slot(const struct rdxtree *tree, rdxtree_key_t key) return rdxtree_lookup_common(tree, key, 1); } +static inline void * +rdxtree_load_slot(void **slot) +{ + return llsync_read_ptr(*slot); +} + /* * Replace a pointer in a tree. * |