1 1.1 christos // SPDX-FileCopyrightText: 2009 Mathieu Desnoyers <mathieu.desnoyers (at) efficios.com> 2 1.1 christos // SPDX-FileCopyrightText: 2009 Paul E. McKenney, IBM Corporation. 3 1.1 christos // 4 1.1 christos // SPDX-License-Identifier: LGPL-2.1-or-later 5 1.1 christos 6 1.1 christos #ifndef _URCU_DEFER_H 7 1.1 christos #define _URCU_DEFER_H 8 1.1 christos 9 1.1 christos /* 10 1.1 christos * Userspace RCU header - deferred execution 11 1.1 christos * 12 1.1 christos * This header is meant to be included indirectly through a liburcu 13 1.1 christos * flavor header. 14 1.1 christos */ 15 1.1 christos 16 1.1 christos #include <stdlib.h> 17 1.1 christos #include <pthread.h> 18 1.1 christos 19 1.1 christos #ifdef __cplusplus 20 1.1 christos extern "C" { 21 1.1 christos #endif 22 1.1 christos 23 1.1 christos /* 24 1.1 christos * Note: the defer_rcu() API is currently EXPERIMENTAL. It may change in the 25 1.1 christos * future. 26 1.1 christos * 27 1.1 christos * Important ! 28 1.1 christos * 29 1.1 christos * Each thread queuing memory reclamation must be registered with 30 1.1 christos * rcu_defer_register_thread(). rcu_defer_unregister_thread() should be 31 1.1 christos * called before the thread exits. 32 1.1 christos * 33 1.1 christos * *NEVER* use defer_rcu() within a RCU read-side critical section, because this 34 1.1 christos * primitive need to call synchronize_rcu() if the thread queue is full. 35 1.1 christos */ 36 1.1 christos 37 1.1 christos extern void defer_rcu(void (*fct)(void *p), void *p); 38 1.1 christos 39 1.1 christos /* 40 1.1 christos * Thread registration for reclamation. 41 1.1 christos */ 42 1.1 christos extern int rcu_defer_register_thread(void); 43 1.1 christos extern void rcu_defer_unregister_thread(void); 44 1.1 christos extern void rcu_defer_barrier(void); 45 1.1 christos extern void rcu_defer_barrier_thread(void); 46 1.1 christos 47 1.1 christos #ifdef __cplusplus 48 1.1 christos } 49 1.1 christos #endif 50 1.1 christos 51 1.1 christos #endif /* _URCU_DEFER_H */ 52