AH_TEMPLATE([GC_SOLARIS_THREADS], [Define to support Solaris pthreads.])
AH_TEMPLATE([GC_WIN32_THREADS], [Define to support Win32 threads.])
AH_TEMPLATE([GC_WIN32_PTHREADS], [Define to support win32-pthreads.])
+AH_TEMPLATE([GC_RTEMS_PTHREADS], [Define to support rtems-pthreads.])
dnl System header feature requests.
AH_TEMPLATE([_POSIX_C_SOURCE], [The POSIX feature macro.])
AC_DEFINE(GC_AIX_THREADS)
AC_DEFINE(_REENTRANT)
;;
+ rtems)
+ THREADS=posix
+ AC_DEFINE(GC_RTEMS_PTHREADS)
+ AC_DEFINE(THREAD_LOCAL_ALLOC)
+ ;;
decosf1 | irix | mach | os2 | solaris | dce | vxworks)
AC_MSG_ERROR(thread package $THREADS not yet supported)
;;
#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
|| 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
/* 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
#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
# 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
# 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"
# 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__
# define HAVE_GET_STACK_BASE
#endif /* GC_SOLARIS_THREADS */
+#ifdef GC_RTEMS_PTHREADS
+ GC_API int GC_CALL GC_get_stack_base(struct GC_stack_base *sb)
+ {
+ sb->mem_base = rtems_get_stack_bottom();
+ return GC_SUCCESS;
+ }
+# define HAVE_GET_STACK_BASE
+#endif /* GC_RTEMS_PTHREADS */
+
#ifndef HAVE_GET_STACK_BASE
/* Retrieve stack base. */
/* Using the GC_find_limit version is risky. */
ABORT("sem_init failed");
# endif
- act.sa_flags = SA_RESTART
+# ifdef SA_RESTART
+ act.sa_flags = SA_RESTART
+# else
+ act.sa_flags = 0
+# endif
# ifdef SA_SIGINFO
- | SA_SIGINFO
+ | SA_SIGINFO
# endif
;
if (sigfillset(&act.sa_mask) != 0) {
ABORT("sigfillset() failed");
}
+# ifdef GC_RTEMS_PTHREADS
+ if(sigprocmask(SIG_UNBLOCK, &act.sa_mask, NULL) != 0) {
+ ABORT("rtems sigprocmask() failed");
+ }
+# endif
GC_remove_allowed_signals(&act.sa_mask);
/* SIG_THR_RESTART is set in the resulting mask. */
/* It is unmasked by the handler when necessary. */
# include <time.h>
# include <errno.h>
# include <unistd.h>
-# include <sys/mman.h>
+# if !defined(GC_RTEMS_PTHREADS)
+# include <sys/mman.h>
+# endif
# include <sys/time.h>
# include <sys/types.h>
# include <sys/stat.h>
GC_nprocs = get_ncpu();
# elif defined(GC_LINUX_THREADS) || defined(GC_DGUX386_THREADS)
GC_nprocs = GC_get_nprocs();
+# elif defined(GC_RTEMS_PTHREADS)
+ GC_nprocs = 1; /* not implemented */
# endif
}
if (GC_nprocs <= 0) {
# ifdef MSWIN32
GC_win32_free_heap();
# endif
- return(0);
+# ifdef RTEMS
+ exit(0);
+# else
+ return(0);
+# endif
}
# endif