#include <mono/metadata/debug-helpers.h>
#include <mono/metadata/assembly.h>
#include <mono/utils/mono-time.h>
+#include <mono/utils/mono-memory-model.h>
#include "trace.h"
#if defined (PLATFORM_ANDROID) || (defined (TARGET_IOS) && defined (TARGET_IOS))
static MonoTraceSpec trace_spec;
+static volatile gint32 output_lock = 0;
+
gboolean
mono_trace_eval_exception (MonoClass *klass)
{
if (!trace_spec.enabled)
return;
+ while (output_lock != 0 || InterlockedCompareExchange (&output_lock, 1, 0) != 0)
+ mono_thread_info_yield ();
+
fname = mono_method_full_name (method, TRUE);
indent (1);
printf ("ENTER: %s(", fname);
if (!ebp) {
printf (") ip: %p\n", RETURN_ADDRESS_N (1));
- return;
- }
+ goto unlock;
+ }
sig = mono_method_signature (method);
if (gsctx && gsctx->is_gsharedvt) {
/* Needs a ctx to get precise method */
printf (") <gsharedvt>\n");
- return;
+ goto unlock;
}
}
}
printf (")\n");
fflush (stdout);
+
+unlock:
+ mono_atomic_store_release (&output_lock, 0);
}
void
if (!trace_spec.enabled)
return;
+ while (output_lock != 0 || InterlockedCompareExchange (&output_lock, 1, 0) != 0)
+ mono_thread_info_yield ();
+
va_start(ap, method);
fname = mono_method_full_name (method, TRUE);
if (gsctx && gsctx->is_gsharedvt) {
/* Needs a ctx to get precise method */
printf (") <gsharedvt>\n");
- return;
+ goto unlock;
}
}
}
//printf (" ip: %p\n", RETURN_ADDRESS_N (1));
printf ("\n");
fflush (stdout);
+
+unlock:
+ mono_atomic_store_release (&output_lock, 0);
}
void