Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Mon Oct 6 16:10:02 CEST 2008 Paolo Molaro <lupus@ximian.com>

	* gc.c, attach.h, attach.c: remove a bad pattern:
	add_finalizer_callback () is not implemented correctly, it can't
	without adding more overhead to the finalizer loop and it's not
	even needed, since we know exactly what we need to call, so there is
	no need to do so through an expensive function pointer.


svn path=/trunk/mono/; revision=114944
  • Loading branch information...
commit 542d5b756e7c134ef33fdd47a9a4df3e7ef7bbed 1 parent fb8e108
@illupus illupus authored
View
9 mono/metadata/ChangeLog
@@ -1,3 +1,12 @@
+
+Mon Oct 6 16:10:02 CEST 2008 Paolo Molaro <lupus@ximian.com>
+
+ * gc.c, attach.h, attach.c: remove a bad pattern:
+ add_finalizer_callback () is not implemented correctly, it can't
+ without adding more overhead to the finalizer loop and it's not
+ even needed, since we know exactly what we need to call, so there is
+ no need to do so through an expensive function pointer.
+
2008-10-04 Zoltan Varga <vargaz@gmail.com>
* gc.c: Define a dummy version of mono_gc_add_finalizer_thread_callback ()
View
13 mono/metadata/attach.c
@@ -108,8 +108,6 @@ static guint32 WINAPI receiver_thread (void *arg);
static void transport_start_receive (void);
-static void maybe_start (gpointer user_data);
-
/*
* Functions to decode protocol data
*/
@@ -197,8 +195,6 @@ void
mono_attach_init (void)
{
InitializeCriticalSection (&agent_mutex);
-
- mono_gc_add_finalizer_thread_callback (maybe_start, NULL);
}
/**
@@ -249,8 +245,8 @@ mono_attach_start (void)
}
/* Called by the finalizer thread when it is woken up */
-static void
-maybe_start (gpointer user_data)
+void
+mono_attach_maybe_start (void)
{
if (!needs_to_start)
return;
@@ -593,6 +589,11 @@ mono_attach_start (void)
}
void
+mono_attach_maybe_start (void)
+{
+}
+
+void
mono_attach_cleanup (void)
{
}
View
3  mono/metadata/attach.h
@@ -13,6 +13,9 @@ gboolean
mono_attach_start (void) MONO_INTERNAL;
void
+mono_attach_maybe_start (void) MONO_INTERNAL;
+
+void
mono_attach_cleanup (void) MONO_INTERNAL;
G_END_DECLS
View
31 mono/metadata/gc.c
@@ -23,6 +23,7 @@
#include <mono/utils/mono-logger.h>
#include <mono/metadata/gc-internal.h>
#include <mono/metadata/marshal.h> /* for mono_delegate_free_ftnptr () */
+#include <mono/metadata/attach.h>
#ifndef PLATFORM_WIN32
#include <pthread.h>
@@ -53,9 +54,6 @@ static MonoMList *threads_to_finalize = NULL;
static MonoThread *gc_thread;
-static FinalizerThreadCallback fin_thread_cb;
-static gpointer fin_thread_cb_user_data;
-
static void object_register_finalizer (MonoObject *obj, void (*callback)(void *, void*));
#ifndef HAVE_NULL_GC
@@ -838,23 +836,6 @@ mono_gc_finalize_notify (void)
SetEvent (finalizer_event);
}
-/*
- * mono_gc_add_finalizer_thread_callback:
- *
- * Register a callback function which will be called by the finalizer thread
- * each time it is woken up. This means the callback should execute quickly, and
- * not block.
- *
- */
-void
-mono_gc_add_finalizer_thread_callback (FinalizerThreadCallback func, gpointer user_data)
-{
- g_assert (!fin_thread_cb);
-
- fin_thread_cb = func;
- fin_thread_cb_user_data = user_data;
-}
-
static void
collect_objects (gpointer key, gpointer value, gpointer user_data)
{
@@ -929,8 +910,9 @@ finalizer_thread (gpointer unused)
/* Use alertable=FALSE since we will be asked to exit using the event too */
WaitForSingleObjectEx (finalizer_event, INFINITE, FALSE);
- if (fin_thread_cb)
- fin_thread_cb (fin_thread_cb_user_data);
+#ifndef DISABLE_ATTACH
+ mono_attach_maybe_start ();
+#endif
if (domains_to_finalize) {
mono_finalizer_lock ();
@@ -1062,11 +1044,6 @@ mono_gc_finalize_notify (void)
{
}
-void
-mono_gc_add_finalizer_thread_callback (FinalizerThreadCallback func, gpointer user_data)
-{
-}
-
void mono_gc_init (void)
{
InitializeCriticalSection (&handle_section);
Please sign in to comment.
Something went wrong with that request. Please try again.