New test.
[mono.git] / mono / os / gc_wrapper.h
index 038c039fbcb6a0e814264ed48d39153af766888f..466057c42ae75a8c57144533449e05a8670a1a96 100644 (file)
         */
        
 #      if defined(HAVE_KW_THREAD) && defined(USE_INCLUDED_LIBGC) && !defined(__powerpc__)
-#              define GC_REDIRECT_TO_LOCAL
+        /* The local alloc stuff is in pthread_support.c, but solaris uses solaris_threads.c */
+        /* It is also disabled on solaris/x86 by libgc/configure.in */
+#       if !defined(__sparc__) && !defined(__sun)
+#                  define GC_REDIRECT_TO_LOCAL
+#       endif
 #      endif
 
 #      ifdef HAVE_GC_GC_H
 #define CreateThread GC_CreateThread
 #endif
 
+#elif defined(HAVE_SGEN_GC)
+
+#if defined(PLATFORM_WIN32)
+#define CreateThread mono_gc_CreateThread
 #else
+/* pthread function wrappers */
+#include <pthread.h>
+#include <signal.h>
+
+int mono_gc_pthread_create (pthread_t *new_thread, const pthread_attr_t *attr, void *(*start_routine)(void *), void *arg);
+int mono_gc_pthread_join (pthread_t thread, void **retval);
+int mono_gc_pthread_detach (pthread_t thread);
+
+#define pthread_create mono_gc_pthread_create
+#define pthread_join mono_gc_pthread_join
+#define pthread_detach mono_gc_pthread_detach
+
+#endif
+
+extern int
+mono_gc_register_root (char *start, size_t size, void *descr);
+extern void mono_gc_base_init (void);
+
+#      define MONO_GC_REGISTER_ROOT(x) mono_gc_register_root (&(x), sizeof(x), NULL)
+#      define MONO_GC_PRE_INIT() mono_gc_base_init ()
+
+#else /* not Boehm and not sgen GC */
 #      define MONO_GC_REGISTER_ROOT(x) /* nop */
 #      define MONO_GC_PRE_INIT()
 #endif