+/*
+ * Copyright 2004-2011 Novell, Inc (http://www.novell.com)
+ * Copyright 2011 Xamarin, Inc (http://www.xamarin.com)
+ */
#ifndef __MONO_OS_GC_WRAPPER_H__
#define __MONO_OS_GC_WRAPPER_H__
# if defined(HAVE_KW_THREAD) && defined(USE_INCLUDED_LIBGC) && !defined(__powerpc__)
/* 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 */
+ /* It is also disabled on solaris/x86 by libgc/configure.ac */
/*
* ARM has no definition for some atomic functions in gc_locks.h and
- * support is also disabled in libgc/configure.in.
+ * support is also disabled in libgc/configure.ac.
*/
# if !defined(__sparc__) && !defined(__sun) && !defined(__arm__) && !defined(__mips__)
# define GC_REDIRECT_TO_LOCAL
# error have boehm GC without headers, you probably need to install them by hand
# endif
-#if defined(PLATFORM_WIN32)
+#if defined(HOST_WIN32)
#define CreateThread GC_CreateThread
#endif
#elif defined(HAVE_SGEN_GC)
-#if defined(PLATFORM_WIN32)
-#define CreateThread mono_gc_CreateThread
-#else
+#else /* not Boehm and not sgen GC */
+#endif
+
+#if !defined(HOST_WIN32)
+
+/*
+ * Both Boehm and SGEN needs to intercept some thread operations. So instead of the
+ * pthread_... calls, runtime code should call these wrappers.
+ */
+
/* 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);
+void mono_gc_pthread_exit (void *retval) G_GNUC_NORETURN;
-#define pthread_create mono_gc_pthread_create
-#define pthread_join mono_gc_pthread_join
-#define pthread_detach mono_gc_pthread_detach
-
-#endif
-
-#else /* not Boehm and not sgen GC */
#endif
#endif