From eebc7e307adab5e922ec93a5a8e9d18708dc6af2 Mon Sep 17 00:00:00 2001 From: Brian Norris Date: Tue, 24 Apr 2012 12:06:21 -0700 Subject: [PATCH] lib*.h: wrap C headers in `extern "C"' --- libatomic.h | 32 ++++++++++++++++++++------------ libthreads.h | 24 ++++++++++++++++-------- 2 files changed, 36 insertions(+), 20 deletions(-) diff --git a/libatomic.h b/libatomic.h index f861445..33cfa62 100644 --- a/libatomic.h +++ b/libatomic.h @@ -1,22 +1,30 @@ #ifndef __LIBATOMIC_H__ #define __LIBATOMIC_H__ -typedef enum memory_order { - memory_order_relaxed, - memory_order_consume, - memory_order_acquire, - memory_order_release, - memory_order_acq_rel, - memory_order_seq_cst -} memory_order; +#ifdef __cplusplus +extern "C" { +#endif -typedef struct atomic_object { -} atomic_int; + typedef enum memory_order { + memory_order_relaxed, + memory_order_consume, + memory_order_acquire, + memory_order_release, + memory_order_acq_rel, + memory_order_seq_cst + } memory_order; -void atomic_store_explicit(struct atomic_object *obj, int value, memory_order order); + typedef struct atomic_object { + } atomic_int; + + void atomic_store_explicit(struct atomic_object *obj, int value, memory_order order); #define atomic_store(A, B) atomic_store_explicit((A), (B), memory_order_seq_cst) -int atomic_load_explicit(struct atomic_object *obj, memory_order order); + int atomic_load_explicit(struct atomic_object *obj, memory_order order); #define atomic_load(A) atomic_load_explicit((A), memory_order_seq_cst) +#ifdef __cplusplus +} +#endif + #endif /* __LIBATOMIC_H__ */ diff --git a/libthreads.h b/libthreads.h index b16c96b..72cc00b 100644 --- a/libthreads.h +++ b/libthreads.h @@ -1,16 +1,24 @@ #ifndef __LIBTHREADS_H__ #define __LIBTHREADS_H__ -typedef int thread_id_t; -typedef void (*thrd_start_t)(); +#ifdef __cplusplus +extern "C" { +#endif -typedef thread_id_t thrd_t; + typedef int thread_id_t; + typedef void (*thrd_start_t)(); -int thrd_create(thrd_t *t, thrd_start_t start_routine, void *arg); -int thrd_join(thrd_t); -int thrd_yield(void); -thrd_t thrd_current(void); + typedef thread_id_t thrd_t; -extern void user_main(void); + int thrd_create(thrd_t *t, thrd_start_t start_routine, void *arg); + int thrd_join(thrd_t); + int thrd_yield(void); + thrd_t thrd_current(void); + + extern void user_main(void); + +#ifdef __cplusplus +} +#endif #endif /* __LIBTHREADS_H__ */ -- 2.34.1