X-Git-Url: http://wien.tomnetworks.com/gitweb/?a=blobdiff_plain;f=mono%2Fmetadata%2Flock-tracer.c;h=551f8a751e8e1d58edac3c6186346d64fd46100c;hb=aefc06ddf682848e3a6a4e0a534f443b335a6167;hp=e0e6ac96a61053d69735feb81d1cbb5e378e5041;hpb=bd52e33266aee6ffbddf313a99db7fffc497a095;p=mono.git diff --git a/mono/metadata/lock-tracer.c b/mono/metadata/lock-tracer.c index e0e6ac96a61..551f8a751e8 100644 --- a/mono/metadata/lock-tracer.c +++ b/mono/metadata/lock-tracer.c @@ -24,15 +24,16 @@ #include "lock-tracer.h" - /* * This is a very simple lock trace implementation. It can be used to verify that the runtime is * correctly following all locking rules. * * To log more kind of locks just do the following: * - add an entry into the RuntimeLocks enum - * - change mono_mutex_lock(mutex) to mono_locks_acquire (mutex, LockName) - * - change mono_mutex_unlock to mono_locks_release (mutex, LockName) + * - change mono_os_mutex_lock(mutex) to mono_locks_os_acquire (mutex, LockName) + * - change mono_os_mutex_unlock(mutex) to mono_locks_os_release (mutex, LockName) + * - change mono_coop_mutex_lock(mutex) to mono_locks_coop_acquire (mutex, LockName) + * - change mono_coop_mutex_unlock(mutex) to mono_locks_coop_release (mutex, LockName) * - change the decoder to understand the new lock kind. * * TODO: @@ -71,7 +72,7 @@ mono_locks_tracer_init (void) Dl_info info; int res; char *name; - mono_mutex_init_recursive (&tracer_lock); + mono_os_mutex_init_recursive (&tracer_lock); if (!g_getenv ("MONO_ENABLE_LOCK_TRACER")) return; name = g_strdup_printf ("locks.%d", getpid ()); @@ -122,7 +123,7 @@ add_record (RecordType record_kind, RuntimeLocks kind, gpointer lock) frames [i] = (gpointer)((size_t)frames[i] - base_address); /*We only dump 5 frames, which should be more than enough to most analysis.*/ - msg = g_strdup_printf ("%x,%d,%d,%p,%p,%p,%p,%p,%p\n", (guint32)GetCurrentThreadId (), record_kind, kind, lock, frames [1], frames [2], frames [3], frames [4], frames [5]); + msg = g_strdup_printf ("%x,%d,%d,%p,%p,%p,%p,%p,%p\n", (guint32)mono_native_thread_id_get (), record_kind, kind, lock, frames [1], frames [2], frames [3], frames [4], frames [5]); fwrite (msg, strlen (msg), 1, trace_file); fflush (trace_file); g_free (msg); @@ -139,5 +140,10 @@ mono_locks_lock_released (RuntimeLocks kind, gpointer lock) { add_record (RECORD_LOCK_RELEASED, kind, lock); } +#else +#ifdef _MSC_VER +// Quiet Visual Studio linker warning, LNK4221, in cases when this source file intentional ends up empty. +void __mono_win32_lock_tracer_quiet_lnk4221(void) {} #endif +#endif /* LOCK_TRACER */