X-Git-Url: http://git.liburcu.org/?a=blobdiff_plain;f=src%2Furcu-bp.c;h=83df1399cd382280e8cedc67a2bf0c854098fa2c;hb=f99c6e92aaa1582e6cd19d93d44d91d968f39aa7;hp=66c877a6686f0c4d11dd9157d2d168bbe2954d4d;hpb=4477a87021ffbfbfdb2a2084d05a084171343d36;p=urcu.git diff --git a/src/urcu-bp.c b/src/urcu-bp.c index 66c877a..83df139 100644 --- a/src/urcu-bp.c +++ b/src/urcu-bp.c @@ -23,6 +23,7 @@ * IBM's contributions to this file may be relicensed under LGPLv2 or later. */ +#define URCU_NO_COMPAT_IDENTIFIERS #define _LGPL_SOURCE #include #include @@ -36,6 +37,7 @@ #include #include +#include #include #include #include @@ -44,6 +46,7 @@ #include #include "urcu-die.h" +#include "urcu-utils.h" #define URCU_API_MAP /* Do not #define _LGPL_SOURCE to ensure we can emit the wrapper symbols */ @@ -72,8 +75,10 @@ void *mremap_wrapper(void *old_address, size_t old_size, * This is not generic. */ static -void *mremap_wrapper(void *old_address, size_t old_size, - size_t new_size, int flags) +void *mremap_wrapper(void *old_address __attribute__((unused)), + size_t old_size __attribute__((unused)), + size_t new_size __attribute__((unused)), + int flags) { assert(!(flags & MREMAP_MAYMOVE)); @@ -143,15 +148,12 @@ static int initialized; static pthread_key_t urcu_bp_key; struct urcu_bp_gp urcu_bp_gp = { .ctr = URCU_BP_GP_COUNT }; -__attribute__((alias("urcu_bp_gp"))) extern struct urcu_bp_gp rcu_gp_bp; /* * Pointer to registry elements. Written to only by each individual reader. Read * by both the reader and the writers. */ DEFINE_URCU_TLS(struct urcu_bp_reader *, urcu_bp_reader); -__attribute__((alias("urcu_bp_reader"))) -extern struct urcu_bp_reader *rcu_reader_bp; static CDS_LIST_HEAD(registry); @@ -294,7 +296,7 @@ void urcu_bp_synchronize_rcu(void) /* * Wait for readers to observe original parity or be quiescent. * wait_for_readers() can release and grab again rcu_registry_lock - * interally. + * internally. */ wait_for_readers(®istry, &cur_snap_readers, &qsreaders); @@ -325,7 +327,7 @@ void urcu_bp_synchronize_rcu(void) /* * Wait for readers to observe new parity or be quiescent. * wait_for_readers() can release and grab again rcu_registry_lock - * interally. + * internally. */ wait_for_readers(&cur_snap_readers, NULL, &qsreaders); @@ -345,7 +347,6 @@ out: ret = pthread_sigmask(SIG_SETMASK, &oldmask, NULL); assert(!ret); } -__attribute__((alias("urcu_bp_synchronize_rcu"))) void synchronize_rcu_bp(); /* * library wrappers to be used by non-LGPL compatible source code. @@ -355,19 +356,16 @@ void urcu_bp_read_lock(void) { _urcu_bp_read_lock(); } -__attribute__((alias("urcu_bp_read_lock"))) void rcu_read_lock_bp(); void urcu_bp_read_unlock(void) { _urcu_bp_read_unlock(); } -__attribute__((alias("urcu_bp_read_unlock"))) void rcu_read_unlock_bp(); int urcu_bp_read_ongoing(void) { return _urcu_bp_read_ongoing(); } -__attribute__((alias("urcu_bp_read_ongoing"))) int rcu_read_ongoing_bp(); /* * Only grow for now. If empty, allocate a ARENA_INIT_ALLOC sized chunk. @@ -563,7 +561,12 @@ end: if (ret) abort(); } -__attribute__((alias("urcu_bp_register"))) void rcu_bp_register(); + +void urcu_bp_register_thread(void) +{ + if (caa_unlikely(!URCU_TLS(urcu_bp_reader))) + urcu_bp_register(); /* If not yet registered. */ +} /* Disable signals, take mutex, remove from registry */ static @@ -689,7 +692,6 @@ void urcu_bp_before_fork(void) mutex_lock(&rcu_registry_lock); saved_fork_signal_mask = oldmask; } -__attribute__((alias("urcu_bp_before_fork"))) void rcu_bp_before_fork(); void urcu_bp_after_fork_parent(void) { @@ -702,8 +704,6 @@ void urcu_bp_after_fork_parent(void) ret = pthread_sigmask(SIG_SETMASK, &oldmask, NULL); assert(!ret); } -__attribute__((alias("urcu_bp_after_fork_parent"))) -void rcu_bp_after_fork_parent(void); /* * Prune all entries from registry except our own thread. Fits the Linux @@ -740,15 +740,11 @@ void urcu_bp_after_fork_child(void) ret = pthread_sigmask(SIG_SETMASK, &oldmask, NULL); assert(!ret); } -__attribute__((alias("urcu_bp_after_fork_child"))) -void rcu_bp_after_fork_child(void); void *urcu_bp_dereference_sym(void *p) { return _rcu_dereference(p); } -__attribute__((alias("urcu_bp_dereference_sym"))) -void *rcu_dereference_sym_bp(); void *urcu_bp_set_pointer_sym(void **p, void *v) { @@ -756,27 +752,20 @@ void *urcu_bp_set_pointer_sym(void **p, void *v) uatomic_set(p, v); return v; } -__attribute__((alias("urcu_bp_set_pointer_sym"))) -void *rcu_set_pointer_sym_bp(); void *urcu_bp_xchg_pointer_sym(void **p, void *v) { cmm_wmb(); return uatomic_xchg(p, v); } -__attribute__((alias("urcu_bp_xchg_pointer_sym"))) -void *rcu_xchg_pointer_sym_bp(); void *urcu_bp_cmpxchg_pointer_sym(void **p, void *old, void *_new) { cmm_wmb(); return uatomic_cmpxchg(p, old, _new); } -__attribute__((alias("urcu_bp_cmpxchg_pointer_sym"))) -void *rcu_cmpxchg_pointer_sym_bp(); DEFINE_RCU_FLAVOR(rcu_flavor); -DEFINE_RCU_FLAVOR_ALIAS(rcu_flavor, alias_rcu_flavor); #include "urcu-call-rcu-impl.h" #include "urcu-defer-impl.h"