From: Mathieu Desnoyers Date: Mon, 7 Dec 2009 14:39:20 +0000 (-0500) Subject: Add extern "C" to support linking userspace RCU library with C++ applications X-Git-Tag: v0.3.2~2 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=36bc70a84250927ba68d5096a0a9740aec157f9b;p=userspace-rcu.git Add extern "C" to support linking userspace RCU library with C++ applications Signed-off-by: Mathieu Desnoyers --- diff --git a/urcu-bp-static.h b/urcu-bp-static.h index ff16fd4..7db2df6 100644 --- a/urcu-bp-static.h +++ b/urcu-bp-static.h @@ -48,6 +48,10 @@ * This is required to permit relinking with newer versions of the library. */ +#ifdef __cplusplus +extern "C" { +#endif + /* * Active attempts to check for reader Q.S. before calling sleep(). */ @@ -194,4 +198,8 @@ static inline void _rcu_read_unlock(void) _STORE_SHARED(urcu_reader->ctr, urcu_reader->ctr - RCU_GP_COUNT); } +#ifdef __cplusplus +} +#endif + #endif /* _URCU_BP_STATIC_H */ diff --git a/urcu-bp.h b/urcu-bp.h index d42a2cb..c0a419f 100644 --- a/urcu-bp.h +++ b/urcu-bp.h @@ -42,6 +42,10 @@ */ #include +#ifdef __cplusplus +extern "C" { +#endif + /* * Important ! * @@ -97,4 +101,8 @@ static inline void urcu_init(void) { } +#ifdef __cplusplus +} +#endif + #endif /* _URCU_BP_H */ diff --git a/urcu-defer-static.h b/urcu-defer-static.h index b27cfe1..8575195 100644 --- a/urcu-defer-static.h +++ b/urcu-defer-static.h @@ -37,6 +37,9 @@ #include #include +#ifdef __cplusplus +extern "C" { +#endif /* * Number of entries in the per-thread defer queue. Must be power of 2. @@ -127,4 +130,8 @@ struct defer_queue { struct list_head list; /* list of thread queues */ }; +#ifdef __cplusplus +} +#endif + #endif /* _URCU_DEFER_STATIC_H */ diff --git a/urcu-defer.h b/urcu-defer.h index 00f18ff..b7fe8bf 100644 --- a/urcu-defer.h +++ b/urcu-defer.h @@ -32,6 +32,10 @@ #include #include +#ifdef __cplusplus +extern "C" { +#endif + /* * Note: the defer_rcu() API is currently EXPERIMENTAL. It may change in the * future. @@ -64,4 +68,8 @@ extern void rcu_defer_unregister_thread(void); extern void rcu_defer_barrier(void); extern void rcu_defer_barrier_thread(void); +#ifdef __cplusplus +} +#endif + #endif /* _URCU_BATCH_H */ diff --git a/urcu-pointer-static.h b/urcu-pointer-static.h index eb073af..093630a 100644 --- a/urcu-pointer-static.h +++ b/urcu-pointer-static.h @@ -34,6 +34,10 @@ #include #include +#ifdef __cplusplus +extern "C" { +#endif + /** * _rcu_dereference - reads (copy) a RCU-protected pointer to a local variable * into a RCU read-side critical section. The pointer can later be safely @@ -121,4 +125,8 @@ #define _rcu_assign_pointer(p, v) _rcu_set_pointer(&(p), v) +#ifdef __cplusplus +} +#endif + #endif /* _URCU_POINTER_STATIC_H */ diff --git a/urcu-pointer.h b/urcu-pointer.h index 948ac42..487abab 100644 --- a/urcu-pointer.h +++ b/urcu-pointer.h @@ -30,6 +30,10 @@ #include #include +#ifdef __cplusplus +extern "C" { +#endif + #ifdef _LGPL_SOURCE #include @@ -107,4 +111,8 @@ extern void *rcu_set_pointer_sym(void **p, void *v); */ #define rcu_assign_pointer(p, v) rcu_set_pointer((&p), (v)) +#ifdef __cplusplus +} +#endif + #endif /* _URCU_POINTER_H */ diff --git a/urcu-qsbr-static.h b/urcu-qsbr-static.h index e49a041..72d3595 100644 --- a/urcu-qsbr-static.h +++ b/urcu-qsbr-static.h @@ -43,6 +43,10 @@ #include #include +#ifdef __cplusplus +extern "C" { +#endif + /* * This code section can only be included in LGPL 2.1 compatible source code. * See below for the function call wrappers which can be used in code meant to @@ -210,4 +214,8 @@ static inline void _rcu_thread_online(void) smp_mb(); } +#ifdef __cplusplus +} +#endif + #endif /* _URCU_QSBR_STATIC_H */ diff --git a/urcu-qsbr.h b/urcu-qsbr.h index 21c2a2e..8e6f1e4 100644 --- a/urcu-qsbr.h +++ b/urcu-qsbr.h @@ -36,6 +36,10 @@ */ #include +#ifdef __cplusplus +extern "C" { +#endif + /* * Important ! * @@ -114,4 +118,8 @@ extern void synchronize_rcu(void); extern void rcu_register_thread(void); extern void rcu_unregister_thread(void); +#ifdef __cplusplus +} +#endif + #endif /* _URCU_QSBR_H */ diff --git a/urcu-static.h b/urcu-static.h index 97d94dc..dec8a20 100644 --- a/urcu-static.h +++ b/urcu-static.h @@ -41,6 +41,10 @@ #include #include +#ifdef __cplusplus +extern "C" { +#endif + /* * This code section can only be included in LGPL 2.1 compatible source code. * See below for the function call wrappers which can be used in code meant to @@ -237,4 +241,8 @@ static inline void _rcu_read_unlock(void) } } +#ifdef __cplusplus +} +#endif + #endif /* _URCU_STATIC_H */ diff --git a/urcu.h b/urcu.h index 69c06e4..da0b295 100644 --- a/urcu.h +++ b/urcu.h @@ -39,6 +39,10 @@ */ #include +#ifdef __cplusplus +extern "C" { +#endif + /* * Important ! * @@ -92,4 +96,8 @@ extern void rcu_unregister_thread(void); */ extern void urcu_init(void); +#ifdef __cplusplus +} +#endif + #endif /* _URCU_H */ diff --git a/urcu/arch_ppc.h b/urcu/arch_ppc.h index 12b018e..49d844b 100644 --- a/urcu/arch_ppc.h +++ b/urcu/arch_ppc.h @@ -25,6 +25,10 @@ #include #include +#ifdef __cplusplus +extern "C" { +#endif + #define CONFIG_HAVE_MEM_COHERENCY /* Include size of POWER5+ L3 cache lines: 256 bytes */ @@ -115,4 +119,8 @@ static inline cycles_t get_cycles (void) } } +#ifdef __cplusplus +} +#endif + #endif /* _URCU_ARCH_PPC_H */ diff --git a/urcu/arch_s390.h b/urcu/arch_s390.h index 9d3d452..b400376 100644 --- a/urcu/arch_s390.h +++ b/urcu/arch_s390.h @@ -31,6 +31,10 @@ #include #include +#ifdef __cplusplus +extern "C" { +#endif + #define CONFIG_HAVE_MEM_COHERENCY #define CACHE_LINE_SIZE 128 @@ -94,4 +98,8 @@ static inline cycles_t get_cycles (void) return cycles; } +#ifdef __cplusplus +} +#endif + #endif /* _URCU_ARCH_S390_H */ diff --git a/urcu/arch_sparc64.h b/urcu/arch_sparc64.h index a260e3a..6dcb908 100644 --- a/urcu/arch_sparc64.h +++ b/urcu/arch_sparc64.h @@ -25,6 +25,10 @@ #include #include +#ifdef __cplusplus +extern "C" { +#endif + #define CONFIG_HAVE_MEM_COHERENCY #define CACHE_LINE_SIZE 256 @@ -100,4 +104,8 @@ static inline cycles_t get_cycles (void) return 0; /* unimplemented */ } +#ifdef __cplusplus +} +#endif + #endif /* _URCU_ARCH_SPARC64_H */ diff --git a/urcu/arch_x86.h b/urcu/arch_x86.h index f137a16..b3f2962 100644 --- a/urcu/arch_x86.h +++ b/urcu/arch_x86.h @@ -25,6 +25,10 @@ #include #include +#ifdef __cplusplus +extern "C" { +#endif + #define CONFIG_HAVE_MEM_COHERENCY #define CACHE_LINE_SIZE 128 @@ -125,4 +129,8 @@ static inline cycles_t get_cycles(void) return ret; } +#ifdef __cplusplus +} +#endif + #endif /* _URCU_ARCH_X86_H */ diff --git a/urcu/uatomic_arch_ppc.h b/urcu/uatomic_arch_ppc.h index a32c789..b732b08 100644 --- a/urcu/uatomic_arch_ppc.h +++ b/urcu/uatomic_arch_ppc.h @@ -23,6 +23,10 @@ #include #include +#ifdef __cplusplus +extern "C" { +#endif + #ifndef __SIZEOF_LONG__ #ifdef __powerpc64__ #define __SIZEOF_LONG__ 8 @@ -227,4 +231,8 @@ unsigned long _uatomic_add_return(void *addr, unsigned long val, #define compat_uatomic_cmpxchg(ptr, old, _new) uatomic_cmpxchg(ptr, old, _new) +#ifdef __cplusplus +} +#endif + #endif /* _URCU_ARCH_UATOMIC_PPC_H */ diff --git a/urcu/uatomic_arch_s390.h b/urcu/uatomic_arch_s390.h index ab7e942..813d970 100644 --- a/urcu/uatomic_arch_s390.h +++ b/urcu/uatomic_arch_s390.h @@ -32,6 +32,10 @@ #include #include +#ifdef __cplusplus +extern "C" { +#endif + #ifndef __SIZEOF_LONG__ #ifdef __s390x__ #define __SIZEOF_LONG__ 8 @@ -216,4 +220,8 @@ unsigned long _uatomic_add_return(void *addr, unsigned long val, int len) #define compat_uatomic_cmpxchg(ptr, old, _new) uatomic_cmpxchg(ptr, old, _new) +#ifdef __cplusplus +} +#endif + #endif /* _URCU_UATOMIC_ARCH_S390_H */ diff --git a/urcu/uatomic_arch_sparc64.h b/urcu/uatomic_arch_sparc64.h index 622fe10..3aa3b7d 100644 --- a/urcu/uatomic_arch_sparc64.h +++ b/urcu/uatomic_arch_sparc64.h @@ -23,6 +23,10 @@ #include #include +#ifdef __cplusplus +extern "C" { +#endif + #ifndef __SIZEOF_LONG__ #ifdef __LP64__ #define __SIZEOF_LONG__ 8 @@ -177,4 +181,8 @@ unsigned long _uatomic_add_return(void *addr, unsigned long val, int len) #define compat_uatomic_cmpxchg(ptr, old, _new) uatomic_cmpxchg(ptr, old, _new) +#ifdef __cplusplus +} +#endif + #endif /* _URCU_ARCH_UATOMIC_PPC_H */ diff --git a/urcu/uatomic_arch_x86.h b/urcu/uatomic_arch_x86.h index 8e0f0a8..b575698 100644 --- a/urcu/uatomic_arch_x86.h +++ b/urcu/uatomic_arch_x86.h @@ -23,6 +23,10 @@ #include #include +#ifdef __cplusplus +extern "C" { +#endif + #ifndef __SIZEOF_LONG__ #if defined(__x86_64__) || defined(__amd64__) #define __SIZEOF_LONG__ 8 @@ -478,4 +482,8 @@ extern unsigned long _compat_uatomic_xchg(void *addr, #define uatomic_inc(addr) UATOMIC_COMPAT(inc(addr)) #define uatomic_dec(addr) UATOMIC_COMPAT(dec(addr)) +#ifdef __cplusplus +} +#endif + #endif /* _URCU_ARCH_UATOMIC_X86_H */ diff --git a/urcu/urcu-futex.h b/urcu/urcu-futex.h index 14fb5c0..95598ad 100644 --- a/urcu/urcu-futex.h +++ b/urcu/urcu-futex.h @@ -23,6 +23,10 @@ #include +#ifdef __cplusplus +extern "C" { +#endif + #define FUTEX_WAIT 0 #define FUTEX_WAKE 1 @@ -55,4 +59,8 @@ extern int compat_futex_async(int *uaddr, int op, int val, compat_futex_async(uaddr, op, val, timeout, uaddr2, val3) #endif +#ifdef __cplusplus +} +#endif + #endif /* _URCU_FUTEX_H */