summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorJie Liu <lj8175@gmail.com>2011-09-09 16:21:49 +0200
committerIvan Maidanski <ivmai@mail.ru>2011-09-09 16:21:49 +0200
commit0539e08bb47d310c01bbb35354954436157110d0 (patch)
tree70556fd88bd88c725b9f935d2a4015a510e5f365 /include
parentd40bcf238067f2be8e9a8327b2e915eeab8d6818 (diff)
Support multi-threading for RTEMS target.
(Apply commit e773036) * configure.ac: Add GC_RTEMS_PTHREADS AH_TEMPLATE and configure for rtems. * os_dep.c: Add GC_get_stack_base if GC_RTEMS_PTHREADS for rtems. * pthread_stop_world.c (GC_stop_init): Add ifdef SA_RESTART. * pthread_stop_world.c (GC_stop_init): Use sigprocmask for rtems when defined GC_RTEMS_PTHREADS. * pthread_support.c: Exclude sys/mman.h for rtems. * pthread_support.c (GC_thr_init): Set default GC_nprocs (1) for rtems. * include/gc_config_macros.h: Define GC_RTEMS_PTHREADS for rtems pthread and define GC_NO_DLOPEN for rtems. * include/private/gc_locks.h: Define USE_PTHREAD_LOCKS for rtems. * include/private/gcconfig.h: Use rtems_get_stack_bottom() for InitStackBottom; and use SIGUSR1 for SIG_SUSPEND, SIGUSR2 for SIG_THR_RESTART on rtems. * include/private/thread_local_alloc.h: Use USE_PTHREAD_SPECIFIC for rtems. * tests/test.c (Init): Use exit(0) for rtems instead of return. * configure: Regenerate. * include/private/config.h.in: Ditto.
Diffstat (limited to 'include')
-rw-r--r--include/gc_config_macros.h14
-rw-r--r--include/private/config.h.in3
-rw-r--r--include/private/gc_locks.h4
-rw-r--r--include/private/gcconfig.h5
-rw-r--r--include/private/thread_local_alloc.h2
5 files changed, 23 insertions, 5 deletions
diff --git a/include/gc_config_macros.h b/include/gc_config_macros.h
index a27f8dd..73db584 100644
--- a/include/gc_config_macros.h
+++ b/include/gc_config_macros.h
@@ -50,6 +50,9 @@
#if defined(WIN32_THREADS)
# define GC_WIN32_THREADS
#endif
+#if defined(RTEMS_THREADS)
+# define GC_RTEMS_PTHREADS
+#endif
#if defined(USE_LD_WRAP)
# define GC_USE_LD_WRAP
#endif
@@ -65,7 +68,7 @@
|| defined(GC_IRIX_THREADS) || defined(GC_LINUX_THREADS) \
|| defined(GC_NETBSD_THREADS) || defined(GC_OPENBSD_THREADS) \
|| defined(GC_OSF1_THREADS) || defined(GC_SOLARIS_THREADS) \
- || defined(GC_WIN32_THREADS)
+ || defined(GC_WIN32_THREADS) || defined(GC_RTEMS_PTHREADS)
# ifndef GC_THREADS
# define GC_THREADS
# endif
@@ -115,11 +118,15 @@
/* Either posix or native Win32 threads. */
# define GC_WIN32_THREADS
# endif
+# if defined(__rtems__) && (defined(i386) || defined(__i386__))
+# define GC_RTEMS_PTHREADS
+# endif
#endif /* GC_THREADS */
#undef GC_PTHREADS
#if (!defined(GC_WIN32_THREADS) || defined(GC_WIN32_PTHREADS) \
- || defined(__CYGWIN32__) || defined(__CYGWIN__)) && defined(GC_THREADS)
+ || defined(GC_RTEMS_PTHREADS) || defined(__CYGWIN32__) \
+ || defined(__CYGWIN__)) && defined(GC_THREADS)
/* Posix threads. */
# define GC_PTHREADS
#endif
@@ -289,7 +296,8 @@
#ifdef GC_PTHREADS
# if (defined(GC_DARWIN_THREADS) || defined(GC_WIN32_PTHREADS) \
- || defined(__native_client__)) && !defined(GC_NO_DLOPEN)
+ || defined(__native_client__) || defined(GC_RTEMS_PTHREADS)) \
+ && !defined(GC_NO_DLOPEN)
/* Either there is no dlopen() or we do not need to intercept it. */
# define GC_NO_DLOPEN
# endif
diff --git a/include/private/config.h.in b/include/private/config.h.in
index a14c0f3..50b2004 100644
--- a/include/private/config.h.in
+++ b/include/private/config.h.in
@@ -66,6 +66,9 @@
/* Define to support Tru64 pthreads. */
#undef GC_OSF1_THREADS
+/* Define to support rtems-pthreads. */
+#undef GC_RTEMS_PTHREADS
+
/* Define to support Solaris pthreads. */
#undef GC_SOLARIS_THREADS
diff --git a/include/private/gc_locks.h b/include/private/gc_locks.h
index 113b4ae..a5d9c35 100644
--- a/include/private/gc_locks.h
+++ b/include/private/gc_locks.h
@@ -51,6 +51,10 @@
# define USE_PTHREAD_LOCKS
# endif
+# if defined(GC_RTEMS_PTHREADS)
+# define USE_PTHREAD_LOCKS
+# endif
+
# if defined(GC_WIN32_THREADS) && !defined(USE_PTHREAD_LOCKS)
# ifndef WIN32_LEAN_AND_MEAN
# define WIN32_LEAN_AND_MEAN 1
diff --git a/include/private/gcconfig.h b/include/private/gcconfig.h
index a3600f1..553f408 100644
--- a/include/private/gcconfig.h
+++ b/include/private/gcconfig.h
@@ -1380,10 +1380,13 @@
# include <sys/unistd.h>
extern int etext[];
extern int end[];
- extern void *InitStackBottom;
+ void *rtems_get_stack_bottom(void);
+# define InitStackBottom rtems_get_stack_bottom()
# define DATASTART ((ptr_t)etext)
# define DATAEND ((ptr_t)end)
# define STACKBOTTOM ((ptr_t)InitStackBottom)
+# define SIG_SUSPEND SIGUSR1
+# define SIG_THR_RESTART SIGUSR2
# endif
# ifdef DOS4GW
# define OS_TYPE "DOS4GW"
diff --git a/include/private/thread_local_alloc.h b/include/private/thread_local_alloc.h
index 55d8fd6..68d6d88 100644
--- a/include/private/thread_local_alloc.h
+++ b/include/private/thread_local_alloc.h
@@ -47,7 +47,7 @@
# define USE_COMPILER_TLS
# elif defined(GC_DGUX386_THREADS) || defined(GC_OSF1_THREADS) \
|| defined(GC_DARWIN_THREADS) || defined(GC_AIX_THREADS) \
- || defined(GC_NETBSD_THREADS)
+ || defined(GC_NETBSD_THREADS) || defined(GC_RTEMS_PTHREADS)
# define USE_PTHREAD_SPECIFIC
# elif defined(GC_HPUX_THREADS)
# ifdef __GNUC__