[threads] Store MonoInternalThread in MonoThreadInfo for use when detaching (#5058)
[mono.git] / mono / metadata / null-gc.c
index 4ee7dd7c9c4f9ea7f327c0ffe7d81a5dcb3e1107..8d662c0ce5f03f935442e0f0a000075f596ffbe9 100644 (file)
@@ -1,5 +1,6 @@
-/*
- * null-gc.c: GC implementation using malloc: will leak everything, just for testing.
+/**
+ * \file
+ * GC implementation using malloc: will leak everything, just for testing.
  *
  * Copyright 2001-2003 Ximian, Inc (http://www.ximian.com)
  * Copyright 2004-2011 Novell, Inc (http://www.novell.com)
 void
 mono_gc_base_init (void)
 {
-       MonoThreadInfoCallbacks cb;
-       int dummy;
-
        mono_counters_init ();
 
 #ifndef HOST_WIN32
        mono_w32handle_init ();
 #endif
 
-       memset (&cb, 0, sizeof (cb));
-       /* TODO: This casts away an incompatible pointer type warning in the same
-                manner that boehm-gc does it. This is probably worth investigating
-                more carefully. */
-       cb.mono_method_is_critical = (gpointer)mono_runtime_is_critical_method;
-
-       mono_threads_init (&cb, sizeof (MonoThreadInfo));
+       mono_thread_callbacks_init ();
+       mono_thread_info_init (sizeof (MonoThreadInfo));
 
-       mono_thread_info_attach (&dummy);
+       mono_thread_info_attach ();
 }
 
 void
@@ -93,12 +86,6 @@ mono_gc_is_gc_thread (void)
        return TRUE;
 }
 
-gboolean
-mono_gc_register_thread (void *baseptr)
-{
-       return TRUE;
-}
-
 int
 mono_gc_walk_heap (int flags, MonoGCReferences callback, void *data)
 {
@@ -302,6 +289,23 @@ mono_gc_is_critical_method (MonoMethod *method)
        return FALSE;
 }
 
+gpointer
+mono_gc_thread_attach (MonoThreadInfo* info)
+{
+       return info;
+}
+
+void
+mono_gc_thread_detach_with_lock (MonoThreadInfo *p)
+{
+}
+
+gboolean
+mono_gc_thread_in_critical_region (MonoThreadInfo *info)
+{
+       return FALSE;
+}
+
 int
 mono_gc_get_aligned_size_for_allocator (int size)
 {
@@ -425,11 +429,17 @@ mono_gc_is_disabled (void)
 }
 
 void
-mono_gc_wbarrier_value_copy_bitmap (gpointer _dest, gpointer _src, int size, unsigned bitmap)
+mono_gc_wbarrier_range_copy (gpointer _dest, gpointer _src, int size)
 {
        g_assert_not_reached ();
 }
 
+void*
+mono_gc_get_range_copy_func (void)
+{
+       return &mono_gc_wbarrier_range_copy;
+}
+
 guint8*
 mono_gc_get_card_table (int *shift_bits, gpointer *card_mask)
 {