Index: src/OFUDPSocket.h ================================================================== --- src/OFUDPSocket.h +++ src/OFUDPSocket.h @@ -321,13 +321,6 @@ * datagrams. */ - (void)close; @end -#ifdef __cplusplus -extern "C" { -#endif -#ifdef __cplusplus -} -#endif - OF_ASSUME_NONNULL_END Index: src/condition.h ================================================================== --- src/condition.h +++ src/condition.h @@ -38,12 +38,18 @@ HANDLE event; int count; } of_condition_t; #endif +#ifdef __cplusplus +extern "C" { +#endif extern bool of_condition_new(of_condition_t *condition); extern bool of_condition_signal(of_condition_t *condition); extern bool of_condition_broadcast(of_condition_t *condition); extern bool of_condition_wait(of_condition_t *condition, of_mutex_t *mutex); extern bool of_condition_timed_wait(of_condition_t *condition, of_mutex_t *mutex, of_time_interval_t timeout); extern bool of_condition_free(of_condition_t *condition); +#ifdef __cplusplus +} +#endif Index: src/mutex.h ================================================================== --- src/mutex.h +++ src/mutex.h @@ -55,10 +55,13 @@ of_mutex_t mutex; of_tlskey_t count; } of_rmutex_t; #endif +#ifdef __cplusplus +extern "C" { +#endif extern bool of_mutex_new(of_mutex_t *mutex); extern bool of_mutex_lock(of_mutex_t *mutex); extern bool of_mutex_trylock(of_mutex_t *mutex); extern bool of_mutex_unlock(of_mutex_t *mutex); extern bool of_mutex_free(of_mutex_t *mutex); @@ -65,10 +68,13 @@ extern bool of_rmutex_new(of_rmutex_t *rmutex); extern bool of_rmutex_lock(of_rmutex_t *rmutex); extern bool of_rmutex_trylock(of_rmutex_t *rmutex); extern bool of_rmutex_unlock(of_rmutex_t *rmutex); extern bool of_rmutex_free(of_rmutex_t *rmutex); +#ifdef __cplusplus +} +#endif /* Spinlocks are inlined for performance. */ static OF_INLINE void of_thread_yield(void) Index: src/once.h ================================================================== --- src/once.h +++ src/once.h @@ -29,6 +29,12 @@ #elif !defined(OF_HAVE_THREADS) typedef int of_once_t; # define OF_ONCE_INIT 0 #endif +#ifdef __cplusplus +extern "C" { +#endif extern void of_once(of_once_t *control, void (*func)(void)); +#ifdef __cplusplus +} +#endif Index: src/thread.h ================================================================== --- src/thread.h +++ src/thread.h @@ -45,11 +45,17 @@ #elif defined(OF_WINDOWS) # define of_thread_is_current(t) (t == GetCurrentThread()) # define of_thread_current GetCurrentThread #endif +#ifdef __cplusplus +extern "C" { +#endif extern bool of_thread_attr_init(of_thread_attr_t *attr); extern bool of_thread_new(of_thread_t *thread, void (*function)(id), id object, const of_thread_attr_t *attr); extern void of_thread_set_name(const char *name); extern bool of_thread_join(of_thread_t thread); extern bool of_thread_detach(of_thread_t thread); +#ifdef __cplusplus +} +#endif Index: src/tlskey.h ================================================================== --- src/tlskey.h +++ src/tlskey.h @@ -31,12 +31,19 @@ typedef pthread_key_t of_tlskey_t; #elif defined(OF_WINDOWS) # include typedef DWORD of_tlskey_t; #endif + +#ifdef __cplusplus +extern "C" { +#endif extern bool of_tlskey_new(of_tlskey_t *key); extern bool of_tlskey_free(of_tlskey_t key); +#ifdef __cplusplus +} +#endif /* TLS keys are inlined for performance. */ #if defined(OF_HAVE_PTHREADS) static OF_INLINE void *