summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
60dd72e)
Some real-time use-cases (e.g. Xenomai) require to perform urcu-bp
thread registration early in the thread life-time before it starts
performing real-time tasks.
Currently, this can be achieved by issuing a urcu_bp_read_lock() and
urcu_bp_read_unlock() pair, or by using urcu_bp_read_ongoing(), while in
the initialization phrase.
However, it seems natural to expect that calling urcu_bp_register_thread()
would have the side effect to perform the lazy thread registration
immediately rather than being a no-op.
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
The BP library flavor stands for "bulletproof". It is specifically
designed to help tracing library to hook on applications without
The BP library flavor stands for "bulletproof". It is specifically
designed to help tracing library to hook on applications without
-requiring to modify these applications. `urcu_bp_init()`,
-`urcu_bp_register_thread()` and `urcu_bp_unregister_thread()` all become
-nops. The state is dealt with by the library internally at the expense
-of read-side and write-side performance.
+requiring to modify these applications. `urcu_bp_init()`, and
+`urcu_bp_unregister_thread()` all become nops, whereas calling
+`urcu_bp_register_thread()` becomes optional. The state is dealt with by
+the library internally at the expense of read-side and write-side
+performance.
extern void urcu_bp_after_fork_child(void);
/*
extern void urcu_bp_after_fork_child(void);
/*
- * In the bulletproof version, the following functions are no-ops.
+ * In the bulletproof version, thread registration is performed lazily,
+ * but it can be forced by issuing an explicit urcu_bp_register_thread().
-static inline void urcu_bp_register_thread(void)
-{
-}
+extern void urcu_bp_register_thread(void);
+/*
+ * In the bulletproof version, the following functions are no-ops.
+ */
static inline void urcu_bp_unregister_thread(void)
{
}
static inline void urcu_bp_unregister_thread(void)
{
}
}
URCU_ATTR_ALIAS("urcu_bp_register") void rcu_bp_register();
}
URCU_ATTR_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
void urcu_bp_unregister(struct rcu_reader *rcu_reader_reg)
/* Disable signals, take mutex, remove from registry */
static
void urcu_bp_unregister(struct rcu_reader *rcu_reader_reg)