summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--extra/gc.c4
-rw-r--r--include/private/pthread_support.h11
-rw-r--r--pthread_start.c5
-rw-r--r--pthread_support.c8
4 files changed, 20 insertions, 8 deletions
diff --git a/extra/gc.c b/extra/gc.c
index 9c16d206..fa70a0a8 100644
--- a/extra/gc.c
+++ b/extra/gc.c
@@ -70,7 +70,9 @@
#include "../specific.c"
#include "../win32_threads.c"
-#include "../pthread_start.c"
+#ifndef GC_PTHREAD_START_STANDALONE
+# include "../pthread_start.c"
+#endif
/* Restore pthread calls redirection (if altered in */
/* pthread_stop_world.c, pthread_support.c or win32_threads.c). */
diff --git a/include/private/pthread_support.h b/include/private/pthread_support.h
index 8820fc47..525a9aac 100644
--- a/include/private/pthread_support.h
+++ b/include/private/pthread_support.h
@@ -136,10 +136,17 @@ GC_EXTERN GC_bool GC_in_thread_creation;
GC_INNER void GC_unblock_gc_signals(void);
#endif
-GC_INNER GC_thread GC_start_rtn_prepare_thread(void *(**pstart)(void *),
+#ifdef GC_PTHREAD_START_STANDALONE
+# define GC_INNER_PTHRSTART /* empty */
+#else
+# define GC_INNER_PTHRSTART GC_INNER
+#endif
+
+GC_INNER_PTHRSTART GC_thread GC_start_rtn_prepare_thread(
+ void *(**pstart)(void *),
void **pstart_arg,
struct GC_stack_base *sb, void *arg);
-GC_INNER void GC_thread_exit_proc(void *);
+GC_INNER_PTHRSTART void GC_thread_exit_proc(void *);
#endif /* GC_PTHREADS && !GC_WIN32_THREADS */
diff --git a/pthread_start.c b/pthread_start.c
index 776a368d..bd4fc4a0 100644
--- a/pthread_start.c
+++ b/pthread_start.c
@@ -42,7 +42,8 @@
#include <sched.h>
/* Invoked from GC_start_routine(). */
-void * GC_CALLBACK GC_inner_start_routine(struct GC_stack_base *sb, void *arg)
+GC_INNER_PTHRSTART void * GC_CALLBACK GC_inner_start_routine(
+ struct GC_stack_base *sb, void *arg)
{
void * (*start)(void *);
void * start_arg;
@@ -54,7 +55,7 @@ void * GC_CALLBACK GC_inner_start_routine(struct GC_stack_base *sb, void *arg)
pthread_cleanup_push(GC_thread_exit_proc, me);
# endif
result = (*start)(start_arg);
-# ifdef DEBUG_THREADS
+# if defined(DEBUG_THREADS) && !defined(GC_PTHREAD_START_STANDALONE)
GC_log_printf("Finishing thread %p\n", (void *)pthread_self());
# endif
me -> status = result;
diff --git a/pthread_support.c b/pthread_support.c
index 994a2edf..c129e63e 100644
--- a/pthread_support.c
+++ b/pthread_support.c
@@ -1361,7 +1361,7 @@ GC_API int GC_CALL GC_unregister_my_thread(void)
/* results in at most a tiny one-time leak. And */
/* linuxthreads doesn't reclaim the main threads */
/* resources or id anyway. */
-GC_INNER void GC_thread_exit_proc(void *arg)
+GC_INNER_PTHRSTART void GC_thread_exit_proc(void *arg)
{
# ifdef DEBUG_THREADS
GC_log_printf("Called GC_thread_exit_proc on %p, gc_thread = %p\n",
@@ -1597,7 +1597,8 @@ struct start_info {
/* Called from GC_inner_start_routine(). Defined in this file to */
/* minimize the number of include files in pthread_start.c (because */
/* sem_t and sem_post() are not used that file directly). */
-GC_INNER GC_thread GC_start_rtn_prepare_thread(void *(**pstart)(void *),
+GC_INNER_PTHRSTART GC_thread GC_start_rtn_prepare_thread(
+ void *(**pstart)(void *),
void **pstart_arg,
struct GC_stack_base *sb, void *arg)
{
@@ -1627,7 +1628,8 @@ GC_INNER GC_thread GC_start_rtn_prepare_thread(void *(**pstart)(void *),
return me;
}
-void * GC_CALLBACK GC_inner_start_routine(struct GC_stack_base *sb, void *arg);
+GC_INNER_PTHRSTART void * GC_CALLBACK GC_inner_start_routine(
+ struct GC_stack_base *sb, void *arg);
/* defined in pthread_start.c */
STATIC void * GC_start_routine(void * arg)