mirror of
https://github.com/encounter/bdwgc.git
synced 2026-03-30 10:57:55 -07:00
Put variable/function declarations into extern 'C' in headers
Issue #201 (bdwgc). Extern "C" should be only around declarations, not includes. In particular, do not include 3rd-party headers (as well as our own files as they could include others). * include/gc.h [GC_PTHREADS]: Do not wrap include gc_pthread_redirects.h into extern "C" block. * include/gc_disclaim.h: Wrap variable and function declarations (but not included headers). * include/gc_inline.h: Likewise. * include/gc_pthread_redirects.h [!GC_PTHREAD_REDIRECTS_ONLY]: Likewise. * include/private/darwin_semaphore.h: Likewise. * include/private/darwin_stop_world.h: Likewise. * include/private/dbg_mlc.h: Likewise. * include/private/gc_atomic_ops.h [GC_BUILTIN_ATOMIC]: Likewise. * include/private/gc_hdrs.h: Likewise. * include/private/gc_locks.h [THREADS]: Likewise. * include/private/gc_pmark.h: Likewise. * include/private/gc_priv.h: Likewise. * include/private/gcconfig.h: Likewise. * include/private/pthread_stop_world.h: Likewise. * include/private/pthread_support.h [GC_PTHREADS && !GC_WIN32_THREADS]: Likewise. * include/private/specific.h: Likewise. * include/private/thread_local_alloc.h [THREAD_LOCAL_ALLOC]: Likewise.
This commit is contained in:
committed by
Ivan Maidanski
parent
a35470707c
commit
f4fbef0f7f
+7
-1
@@ -1620,7 +1620,13 @@ GC_API void (GC_CALLBACK * GC_is_visible_print_proc)(void *);
|
||||
#ifdef GC_PTHREADS
|
||||
/* For pthread support, we generally need to intercept a number of */
|
||||
/* thread library calls. We do that here by macro defining them. */
|
||||
# ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
# endif
|
||||
# include "gc_pthread_redirects.h"
|
||||
# ifdef __cplusplus
|
||||
extern "C" {
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/* This returns a list of objects, linked through their first word. */
|
||||
@@ -2003,7 +2009,7 @@ GC_API void GC_CALL GC_win32_free_heap(void);
|
||||
#endif /* _AMIGA && !GC_AMIGA_MAKINGLIB */
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* end of extern "C" */
|
||||
} /* extern "C" */
|
||||
#endif
|
||||
|
||||
#endif /* GC_H */
|
||||
|
||||
@@ -17,6 +17,10 @@
|
||||
|
||||
#include "gc.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* This API is defined only if the library has been suitably compiled */
|
||||
/* (i.e. with ENABLE_DISCLAIM defined). */
|
||||
|
||||
@@ -55,4 +59,8 @@ GC_API GC_ATTR_MALLOC GC_ATTR_ALLOC_SIZE(1) void * GC_CALL
|
||||
GC_finalized_malloc(size_t /*size*/,
|
||||
const struct GC_finalizer_closure * /*fc*/);
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
@@ -47,6 +47,10 @@
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#ifndef GC_PREFETCH_FOR_WRITE
|
||||
# if GC_GNUC_PREREQ(3, 0) && !defined(GC_NO_PREFETCH_FOR_WRITE)
|
||||
# define GC_PREFETCH_FOR_WRITE(x) __builtin_prefetch((x), 1)
|
||||
@@ -182,4 +186,8 @@ GC_API GC_ATTR_MALLOC GC_ATTR_ALLOC_SIZE(1) void * GC_CALL
|
||||
GC_API void GC_CALL GC_print_free_list(int /* kind */,
|
||||
size_t /* sz_in_granules */);
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
#endif
|
||||
|
||||
#endif /* !GC_INLINE_H */
|
||||
|
||||
@@ -31,19 +31,28 @@
|
||||
/* to thread specific data on the thread stack. */
|
||||
|
||||
#ifndef GC_PTHREAD_REDIRECTS_ONLY
|
||||
|
||||
# include <pthread.h>
|
||||
# ifndef GC_NO_DLOPEN
|
||||
# include <dlfcn.h>
|
||||
# endif
|
||||
# ifndef GC_NO_PTHREAD_SIGMASK
|
||||
# include <signal.h> /* needed anyway for proper redirection */
|
||||
# endif
|
||||
|
||||
# ifdef __cplusplus
|
||||
extern "C" {
|
||||
# endif
|
||||
|
||||
# ifndef GC_SUSPEND_THREAD_ID
|
||||
# define GC_SUSPEND_THREAD_ID pthread_t
|
||||
# endif
|
||||
|
||||
# ifndef GC_NO_DLOPEN
|
||||
# include <dlfcn.h>
|
||||
GC_API void *GC_dlopen(const char * /* path */, int /* mode */);
|
||||
# endif /* !GC_NO_DLOPEN */
|
||||
|
||||
# ifndef GC_NO_PTHREAD_SIGMASK
|
||||
# include <signal.h> /* needed anyway for proper redirection */
|
||||
# if defined(GC_PTHREAD_SIGMASK_NEEDED) \
|
||||
|| defined(_BSD_SOURCE) || defined(_GNU_SOURCE) \
|
||||
|| (_POSIX_C_SOURCE >= 199506L) || (_XOPEN_SOURCE >= 500)
|
||||
@@ -71,6 +80,11 @@
|
||||
# define GC_PTHREAD_EXIT_DECLARED
|
||||
GC_API void GC_pthread_exit(void *) GC_PTHREAD_EXIT_ATTRIBUTE;
|
||||
# endif
|
||||
|
||||
# ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
# endif
|
||||
|
||||
#endif /* !GC_PTHREAD_REDIRECTS_ONLY */
|
||||
|
||||
#if !defined(GC_NO_THREAD_REDIRECTS) && !defined(GC_USE_LD_WRAP)
|
||||
|
||||
@@ -22,6 +22,10 @@
|
||||
# error darwin_semaphore.h included with GC_DARWIN_THREADS not defined
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* This is a very simple semaphore implementation for Darwin. It is */
|
||||
/* implemented in terms of pthread calls so it is not async signal */
|
||||
/* safe. But this is not a problem because signals are not used to */
|
||||
@@ -77,4 +81,8 @@ GC_INLINE int sem_destroy(sem_t *sem) {
|
||||
|| pthread_mutex_destroy(&sem->mutex) != 0 ? -1 : 0;
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
@@ -25,6 +25,10 @@
|
||||
#include <mach/mach.h>
|
||||
#include <mach/thread_act.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
struct thread_stop_info {
|
||||
mach_port_t mach_thread;
|
||||
ptr_t stack_ptr; /* Valid only when thread is in a "blocked" state. */
|
||||
@@ -43,4 +47,8 @@ struct thread_stop_info {
|
||||
GC_INNER GC_bool GC_is_mach_marker(thread_act_t);
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
@@ -30,6 +30,10 @@
|
||||
# include "gc_backptr.h"
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#if CPP_WORDSZ == 32
|
||||
# define START_FLAG (word)0xfedcedcb
|
||||
# define END_FLAG (word)0xbcdecdef
|
||||
@@ -167,4 +171,8 @@ typedef struct {
|
||||
# define GC_HAS_DEBUG_INFO(p) (GC_has_other_debug_info(p) > 0)
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
#endif
|
||||
|
||||
#endif /* _DBG_MLC_H */
|
||||
|
||||
@@ -23,6 +23,11 @@
|
||||
#ifdef GC_BUILTIN_ATOMIC
|
||||
|
||||
# include "gc.h" /* for GC_word */
|
||||
|
||||
# ifdef __cplusplus
|
||||
extern "C" {
|
||||
# endif
|
||||
|
||||
typedef GC_word AO_t;
|
||||
|
||||
# ifdef GC_PRIVATE_H /* have GC_INLINE */
|
||||
@@ -83,6 +88,10 @@
|
||||
# define AO_HAVE_compare_and_swap_release
|
||||
# endif
|
||||
|
||||
# ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
# endif
|
||||
|
||||
#else
|
||||
/* Fallback to libatomic_ops. */
|
||||
# include "atomic_ops.h"
|
||||
|
||||
@@ -15,6 +15,10 @@
|
||||
#ifndef GC_HEADERS_H
|
||||
#define GC_HEADERS_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef struct hblkhdr hdr;
|
||||
|
||||
#if CPP_WORDSZ != 32 && CPP_WORDSZ < 36
|
||||
@@ -208,4 +212,8 @@ typedef struct bi {
|
||||
/* h. Assumes hhdr == HDR(h) and IS_FORWARDING_ADDR(hhdr). */
|
||||
#define FORWARDED_ADDR(h, hhdr) ((struct hblk *)(h) - (size_t)(hhdr))
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
#endif
|
||||
|
||||
#endif /* GC_HEADERS_H */
|
||||
|
||||
@@ -36,6 +36,13 @@
|
||||
# ifdef PCR
|
||||
# include <base/PCR_Base.h>
|
||||
# include <th/PCR_Th.h>
|
||||
# endif
|
||||
|
||||
# ifdef __cplusplus
|
||||
extern "C" {
|
||||
# endif
|
||||
|
||||
# ifdef PCR
|
||||
GC_EXTERN PCR_Th_ML GC_allocate_ml;
|
||||
# if defined(CPPCHECK)
|
||||
# define DCL_LOCK_STATE /* empty */
|
||||
@@ -55,11 +62,17 @@
|
||||
# endif
|
||||
|
||||
# if defined(GC_WIN32_THREADS) && !defined(USE_PTHREAD_LOCKS)
|
||||
# ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
# endif
|
||||
# ifndef WIN32_LEAN_AND_MEAN
|
||||
# define WIN32_LEAN_AND_MEAN 1
|
||||
# endif
|
||||
# define NOSERVICE
|
||||
# include <windows.h>
|
||||
# ifdef __cplusplus
|
||||
extern "C" {
|
||||
# endif
|
||||
# define NO_THREAD (DWORD)(-1)
|
||||
GC_EXTERN CRITICAL_SECTION GC_allocate_ml;
|
||||
# ifdef GC_ASSERTIONS
|
||||
@@ -86,8 +99,13 @@
|
||||
# define UNCOND_UNLOCK() LeaveCriticalSection(&GC_allocate_ml)
|
||||
# endif /* !GC_ASSERTIONS */
|
||||
# elif defined(GC_PTHREADS)
|
||||
# ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
# endif
|
||||
# include <pthread.h>
|
||||
|
||||
# ifdef __cplusplus
|
||||
extern "C" {
|
||||
# endif
|
||||
/* Posix allows pthread_t to be a struct, though it rarely is. */
|
||||
/* Unfortunately, we need to use a pthread_t to index a data */
|
||||
/* structure. It also helps if comparisons don't involve a */
|
||||
@@ -123,7 +141,13 @@
|
||||
/* != NUMERIC_THREAD_ID(pthread_self()) for any thread */
|
||||
|
||||
# ifdef SN_TARGET_PSP2
|
||||
# ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
# endif
|
||||
# include "psp2-support.h"
|
||||
# ifdef __cplusplus
|
||||
extern "C" {
|
||||
# endif
|
||||
GC_EXTERN WapiMutex GC_allocate_ml_PSP2;
|
||||
# define UNCOND_LOCK() { int res; GC_ASSERT(I_DONT_HOLD_LOCK()); \
|
||||
res = PSP2_MutexLock(&GC_allocate_ml_PSP2); \
|
||||
@@ -167,7 +191,13 @@
|
||||
# endif
|
||||
# endif /* THREAD_LOCAL_ALLOC || USE_PTHREAD_LOCKS */
|
||||
# ifdef USE_PTHREAD_LOCKS
|
||||
# ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
# endif
|
||||
# include <pthread.h>
|
||||
# ifdef __cplusplus
|
||||
extern "C" {
|
||||
# endif
|
||||
GC_EXTERN pthread_mutex_t GC_allocate_ml;
|
||||
# ifdef GC_ASSERTIONS
|
||||
# define UNCOND_LOCK() { GC_ASSERT(I_DONT_HOLD_LOCK()); \
|
||||
@@ -233,6 +263,10 @@
|
||||
# endif
|
||||
# endif
|
||||
|
||||
# ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
# endif
|
||||
|
||||
# else /* !THREADS */
|
||||
# define LOCK() (void)0
|
||||
# define UNLOCK() (void)0
|
||||
|
||||
@@ -48,6 +48,10 @@
|
||||
# include "gc_priv.h"
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* The real declarations of the following is in gc_priv.h, so that */
|
||||
/* we can avoid scanning the following table. */
|
||||
/*
|
||||
@@ -478,4 +482,8 @@ typedef int mark_state_t; /* Current state of marking, as follows:*/
|
||||
|
||||
GC_EXTERN mark_state_t GC_mark_state;
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
#endif
|
||||
|
||||
#endif /* GC_PMARK_H */
|
||||
|
||||
+62
-22
@@ -313,6 +313,10 @@ typedef char * ptr_t; /* A generic pointer to which we can add */
|
||||
/* This is now really controlled at startup, */
|
||||
/* through GC_all_interior_pointers. */
|
||||
|
||||
/* Note: never put extern "C" around an #include. */
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#ifndef GC_NO_FINALIZATION
|
||||
# define GC_INVOKE_FINALIZERS() GC_notify_or_invoke_finalizers()
|
||||
@@ -403,6 +407,9 @@ typedef char * ptr_t; /* A generic pointer to which we can add */
|
||||
GC_INNER void GC_print_callers(struct callinfo info[NFRAMES]);
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
#endif
|
||||
|
||||
/*********************************/
|
||||
/* */
|
||||
@@ -440,8 +447,14 @@ typedef char * ptr_t; /* A generic pointer to which we can add */
|
||||
# define MS_TIME_DIFF(a,b) ((long)((a)-(b)))
|
||||
#elif defined(NN_PLATFORM_CTR)
|
||||
# define CLOCK_TYPE long long
|
||||
# ifdef __cplusplus
|
||||
extern "C" {
|
||||
# endif
|
||||
CLOCK_TYPE n3ds_get_system_tick(void);
|
||||
CLOCK_TYPE n3ds_convert_tick_to_ms(CLOCK_TYPE tick);
|
||||
# ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
# endif
|
||||
# define GET_TIME(x) (void)(x = n3ds_get_system_tick())
|
||||
# define MS_TIME_DIFF(a,b) ((long)n3ds_convert_tick_to_ms((a)-(b)))
|
||||
#else /* !BSD_TIME && !NN_PLATFORM_CTR && !MSWIN32 && !MSWINCE */
|
||||
@@ -495,11 +508,18 @@ typedef char * ptr_t; /* A generic pointer to which we can add */
|
||||
# define BZERO(x,n) bzero((void *)(x),(size_t)(n))
|
||||
# endif
|
||||
|
||||
#ifdef PCR
|
||||
# include "th/PCR_ThCtl.h"
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Stop and restart mutator threads.
|
||||
*/
|
||||
# ifdef PCR
|
||||
# include "th/PCR_ThCtl.h"
|
||||
# define STOP_WORLD() \
|
||||
PCR_ThCtl_SetExclusiveMode(PCR_ThCtl_ExclusiveMode_stopNormal, \
|
||||
PCR_allSigsBlocked, \
|
||||
@@ -638,6 +658,10 @@ GC_EXTERN GC_warn_proc GC_current_warn_proc;
|
||||
# define GETENV(name) getenv(name)
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
#endif
|
||||
|
||||
#if defined(DARWIN)
|
||||
# include <mach/thread_status.h>
|
||||
# ifndef MAC_OS_X_VERSION_MAX_ALLOWED
|
||||
@@ -719,6 +743,25 @@ GC_EXTERN GC_warn_proc GC_current_warn_proc;
|
||||
# endif
|
||||
#endif /* DARWIN */
|
||||
|
||||
#ifdef PARALLEL_MARK
|
||||
# include "gc_atomic_ops.h"
|
||||
# define counter_t volatile AO_t
|
||||
#else
|
||||
typedef size_t counter_t;
|
||||
# if defined(THREADS) && (defined(MPROTECT_VDB) || defined(THREAD_SANITIZER) \
|
||||
|| (defined(GC_ASSERTIONS) && defined(THREAD_LOCAL_ALLOC)))
|
||||
# include "gc_atomic_ops.h"
|
||||
# endif
|
||||
#endif /* !PARALLEL_MARK */
|
||||
|
||||
#include "../gc_tiny_fl.h"
|
||||
|
||||
#include <setjmp.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*********************************/
|
||||
/* */
|
||||
/* Word-size-dependent defines */
|
||||
@@ -750,7 +793,7 @@ GC_EXTERN GC_warn_proc GC_current_warn_proc;
|
||||
/* separate free lists for each multiple of GRANULE_BYTES */
|
||||
/* up to (TINY_FREELISTS-1) * GRANULE_BYTES. After that they */
|
||||
/* may be spread out further. */
|
||||
#include "../gc_tiny_fl.h"
|
||||
|
||||
#define GRANULE_BYTES GC_GRANULE_BYTES
|
||||
#define TINY_FREELISTS GC_TINY_FREELISTS
|
||||
|
||||
@@ -966,17 +1009,6 @@ typedef word page_hash_table[PHT_SIZE];
|
||||
/* initial group of mark bits, and it is safe */
|
||||
/* to allocate smaller header for large objects. */
|
||||
|
||||
#ifdef PARALLEL_MARK
|
||||
# include "gc_atomic_ops.h"
|
||||
# define counter_t volatile AO_t
|
||||
#else
|
||||
typedef size_t counter_t;
|
||||
# if defined(THREADS) && (defined(MPROTECT_VDB) || defined(THREAD_SANITIZER) \
|
||||
|| (defined(GC_ASSERTIONS) && defined(THREAD_LOCAL_ALLOC)))
|
||||
# include "gc_atomic_ops.h"
|
||||
# endif
|
||||
#endif /* !PARALLEL_MARK */
|
||||
|
||||
union word_ptr_ao_u {
|
||||
word w;
|
||||
signed_word sw;
|
||||
@@ -2216,14 +2248,8 @@ GC_API_PRIV void GC_err_printf(const char * format, ...)
|
||||
|
||||
/* Basic logging routine. Typically, GC_log_printf is called directly */
|
||||
/* only inside various DEBUG_x blocks. */
|
||||
#if defined(__cplusplus) && defined(SYMBIAN)
|
||||
extern "C" {
|
||||
#endif
|
||||
GC_API_PRIV void GC_log_printf(const char * format, ...)
|
||||
GC_ATTR_FORMAT_PRINTF(1, 2);
|
||||
#if defined(__cplusplus) && defined(SYMBIAN)
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifndef GC_ANDROID_LOG
|
||||
# define GC_PRINT_STATS_FLAG (GC_print_stats != 0)
|
||||
@@ -2549,8 +2575,6 @@ GC_INNER ptr_t GC_store_debug_info(ptr_t p, word sz, const char *str,
|
||||
# define GC_SEM_INIT_PSHARED 0
|
||||
#endif
|
||||
|
||||
#include <setjmp.h>
|
||||
|
||||
/* Some macros for setjmp that works across signal handlers */
|
||||
/* were possible, and a couple of routines to facilitate */
|
||||
/* catching accesses to bad addresses when that's */
|
||||
@@ -2558,7 +2582,13 @@ GC_INNER ptr_t GC_store_debug_info(ptr_t p, word sz, const char *str,
|
||||
#if (defined(UNIX_LIKE) || (defined(NEED_FIND_LIMIT) && defined(CYGWIN32))) \
|
||||
&& !defined(GC_NO_SIGSETJMP)
|
||||
# if defined(SUNOS5SIGS) && !defined(FREEBSD) && !defined(LINUX)
|
||||
# include <sys/siginfo.h>
|
||||
# ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
# endif
|
||||
# include <sys/siginfo.h>
|
||||
# ifdef __cplusplus
|
||||
extern "C" {
|
||||
# endif
|
||||
# endif
|
||||
/* Define SETJMP and friends to be the version that restores */
|
||||
/* the signal mask. */
|
||||
@@ -2591,7 +2621,13 @@ GC_INNER ptr_t GC_store_debug_info(ptr_t p, word sz, const char *str,
|
||||
#endif
|
||||
|
||||
#if defined(DATASTART_USES_BSDGETDATASTART)
|
||||
# ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
# endif
|
||||
# include <machine/trap.h>
|
||||
# ifdef __cplusplus
|
||||
extern "C" {
|
||||
# endif
|
||||
# if !defined(PCR)
|
||||
# define NEED_FIND_LIMIT
|
||||
# endif
|
||||
@@ -2650,4 +2686,8 @@ GC_INNER ptr_t GC_store_debug_info(ptr_t p, word sz, const char *str,
|
||||
# define ASSERT_CANCEL_DISABLED() (void)0
|
||||
#endif /* !CANCEL_SAFE */
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
#endif
|
||||
|
||||
#endif /* GC_PRIVATE_H */
|
||||
|
||||
+301
-49
File diff suppressed because it is too large
Load Diff
@@ -18,6 +18,11 @@
|
||||
#ifndef GC_PTHREAD_STOP_WORLD_H
|
||||
#define GC_PTHREAD_STOP_WORLD_H
|
||||
|
||||
/* Note: never put extern "C" around an #include. */
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
struct thread_stop_info {
|
||||
# if !defined(GC_OPENBSD_UTHREADS) && !defined(NACL)
|
||||
volatile AO_t last_stop_count;
|
||||
@@ -46,4 +51,8 @@ struct thread_stop_info {
|
||||
|
||||
GC_INNER void GC_stop_init(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
@@ -36,6 +36,11 @@
|
||||
# include "dbg_mlc.h" /* for oh type */
|
||||
#endif
|
||||
|
||||
/* Note: never put extern "C" around an #include. */
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* We use the allocation lock to protect thread-related data structures. */
|
||||
|
||||
/* The set of all known threads. We intercept thread creation and */
|
||||
@@ -176,6 +181,10 @@ GC_INNER_PTHRSTART GC_thread GC_start_rtn_prepare_thread(
|
||||
struct GC_stack_base *sb, void *arg);
|
||||
GC_INNER_PTHRSTART void GC_thread_exit_proc(void *);
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
#endif
|
||||
|
||||
#endif /* GC_PTHREADS && !GC_WIN32_THREADS */
|
||||
|
||||
#endif /* GC_PTHREAD_SUPPORT_H */
|
||||
|
||||
@@ -16,6 +16,11 @@
|
||||
|
||||
#include "gc_atomic_ops.h"
|
||||
|
||||
/* Note: never put extern "C" around an #include. */
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* Called during key creation or setspecific. */
|
||||
/* For the GC we already hold lock. */
|
||||
/* Currently allocated objects leak on thread exit. */
|
||||
@@ -99,3 +104,7 @@ GC_INLINE void * GC_getspecific(tsd * key)
|
||||
}
|
||||
return GC_slow_getspecific(key, qtid, entry_ptr);
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
#endif
|
||||
|
||||
@@ -32,6 +32,13 @@
|
||||
# error USE_HPUX_TLS macro was replaced by USE_COMPILER_TLS
|
||||
#endif
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
/* Note: never put extern "C" around an #include. */
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#if !defined(USE_PTHREAD_SPECIFIC) && !defined(USE_WIN32_SPECIFIC) \
|
||||
&& !defined(USE_WIN32_COMPILER_TLS) && !defined(USE_COMPILER_TLS) \
|
||||
&& !defined(USE_CUSTOM_SPECIFIC)
|
||||
@@ -71,8 +78,6 @@
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
#ifndef THREAD_FREELISTS_KINDS
|
||||
# ifdef ENABLE_DISCLAIM
|
||||
# define THREAD_FREELISTS_KINDS (NORMAL+2)
|
||||
@@ -128,11 +133,17 @@ typedef struct thread_local_freelists {
|
||||
# define GC_remove_specific_after_fork(key, t) (void)0
|
||||
typedef void * GC_key_t;
|
||||
#elif defined(USE_WIN32_SPECIFIC)
|
||||
# ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
# endif
|
||||
# ifndef WIN32_LEAN_AND_MEAN
|
||||
# define WIN32_LEAN_AND_MEAN 1
|
||||
# endif
|
||||
# define NOSERVICE
|
||||
# include <windows.h>
|
||||
# ifdef __cplusplus
|
||||
extern "C" {
|
||||
# endif
|
||||
# define GC_getspecific TlsGetValue
|
||||
# define GC_setspecific(key, v) !TlsSetValue(key, v)
|
||||
/* We assume 0 == success, msft does the opposite. */
|
||||
@@ -147,7 +158,13 @@ typedef struct thread_local_freelists {
|
||||
# define GC_remove_specific_after_fork(key, t) (void)0
|
||||
typedef DWORD GC_key_t;
|
||||
#elif defined(USE_CUSTOM_SPECIFIC)
|
||||
# ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
# endif
|
||||
# include "private/specific.h"
|
||||
# ifdef __cplusplus
|
||||
extern "C" {
|
||||
# endif
|
||||
#else
|
||||
# error implement me
|
||||
#endif
|
||||
@@ -182,6 +199,10 @@ extern
|
||||
/* for cleanup on thread exit. But the thread support layer makes sure */
|
||||
/* that GC_thread_key is traced, if necessary. */
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
#endif
|
||||
|
||||
#endif /* THREAD_LOCAL_ALLOC */
|
||||
|
||||
#endif /* GC_THREAD_LOCAL_ALLOC_H */
|
||||
|
||||
Reference in New Issue
Block a user