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