* Author:
* Zoltan Varga (vargaz@gmail.com)
*
- * (C) 2007-2008 Novell, Inc.
+ * Copyright 2007-2009 Novell, Inc (http://www.novell.com)
*/
#include <config.h>
#include <glib.h>
-#ifdef PLATFORM_WIN32
+#ifdef HOST_WIN32
#define DISABLE_ATTACH
#endif
#ifndef DISABLE_ATTACH
static void transport_start_receive (void);
-static void maybe_start (gpointer user_data);
-
/*
* Functions to decode protocol data
*/
void
mono_attach_parse_options (char *options)
{
- config.enabled = TRUE;
-
if (!options)
return;
if (!strcmp (options, "disable"))
{
InitializeCriticalSection (&agent_mutex);
-#ifndef HAVE_NULL_GC
- mono_gc_add_finalizer_thread_callback (maybe_start, NULL);
-#endif
+ config.enabled = TRUE;
}
/**
* do the actual startup.
*/
needs_to_start = TRUE;
- // FIXME: This is not actually signal-safe
mono_gc_finalize_notify ();
return TRUE;
}
/* 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;
*/
/* FIXME: Use TMP ? */
pw = NULL;
+#ifdef HAVE_GETPWUID_R
res = getpwuid_r (getuid (), &pwbuf, buf, sizeof (buf), &pw);
+#else
+ pw = getpwuid(getuid ());
+ res = pw != NULL ? 0 : 1;
+#endif
if (res != 0) {
fprintf (stderr, "attach: getpwuid_r () failed.\n");
return;
if (!listen_fd)
return;
- receiver_thread_handle = CreateThread (NULL, 0, receiver_thread, NULL, 0, &tid);
+ receiver_thread_handle = mono_create_thread (NULL, 0, receiver_thread, NULL, 0, &tid);
g_assert (receiver_thread_handle);
}
/* Ask the runtime to not abort this thread */
//mono_thread_current ()->flags |= MONO_THREAD_FLAG_DONT_MANAGE;
/* Ask the runtime to not wait for this thread */
- mono_thread_current ()->state |= ThreadState_Background;
+ mono_thread_internal_current ()->state |= ThreadState_Background;
while (TRUE) {
char *cmd, *agent_name, *agent_args;
return FALSE;
}
+void
+mono_attach_maybe_start (void)
+{
+}
+
void
mono_attach_cleanup (void)
{