| 1 | #ifndef _URCU_DEFER_H |
| 2 | #define _URCU_DEFER_H |
| 3 | |
| 4 | /* |
| 5 | * urcu/defer.h |
| 6 | * |
| 7 | * Userspace RCU header - deferred execution |
| 8 | * |
| 9 | * Copyright (c) 2009 Mathieu Desnoyers <mathieu.desnoyers@efficios.com> |
| 10 | * Copyright (c) 2009 Paul E. McKenney, IBM Corporation. |
| 11 | * |
| 12 | * This header is meant to be included indirectly through a liburcu |
| 13 | * flavor header. |
| 14 | * |
| 15 | * This library is free software; you can redistribute it and/or |
| 16 | * modify it under the terms of the GNU Lesser General Public |
| 17 | * License as published by the Free Software Foundation; either |
| 18 | * version 2.1 of the License, or (at your option) any later version. |
| 19 | * |
| 20 | * This library is distributed in the hope that it will be useful, |
| 21 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 22 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 23 | * Lesser General Public License for more details. |
| 24 | * |
| 25 | * You should have received a copy of the GNU Lesser General Public |
| 26 | * License along with this library; if not, write to the Free Software |
| 27 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
| 28 | */ |
| 29 | |
| 30 | #include <stdlib.h> |
| 31 | #include <pthread.h> |
| 32 | |
| 33 | #ifdef __cplusplus |
| 34 | extern "C" { |
| 35 | #endif |
| 36 | |
| 37 | /* |
| 38 | * Note: the defer_rcu() API is currently EXPERIMENTAL. It may change in the |
| 39 | * future. |
| 40 | * |
| 41 | * Important ! |
| 42 | * |
| 43 | * Each thread queuing memory reclamation must be registered with |
| 44 | * rcu_defer_register_thread(). rcu_defer_unregister_thread() should be |
| 45 | * called before the thread exits. |
| 46 | * |
| 47 | * *NEVER* use defer_rcu() within a RCU read-side critical section, because this |
| 48 | * primitive need to call synchronize_rcu() if the thread queue is full. |
| 49 | */ |
| 50 | |
| 51 | extern void defer_rcu(void (*fct)(void *p), void *p); |
| 52 | |
| 53 | /* |
| 54 | * Thread registration for reclamation. |
| 55 | */ |
| 56 | extern int rcu_defer_register_thread(void); |
| 57 | extern void rcu_defer_unregister_thread(void); |
| 58 | extern void rcu_defer_barrier(void); |
| 59 | extern void rcu_defer_barrier_thread(void); |
| 60 | |
| 61 | #ifdef __cplusplus |
| 62 | } |
| 63 | #endif |
| 64 | |
| 65 | #endif /* _URCU_DEFER_H */ |